MSCO 2.10.1: car doors and garage door synced, door lock fix, perf tools
- Car doors (FSM with bool "Open" and "Open door"/"Close door") are synced as open/closed: the receiver removes the hold joint and frees the hinge, closing runs the game's own logic - Fix: every synced close of an already closed Satsuma door added another FixedJoint, so the door could not be opened anymore; extra joints are removed automatically - Hinge sync also covers world doors/gates with hinges (garage door), interaction by bounds - Scene name read once per frame (Application.loadedLevelName allocates a string per call) - Console "perf" (FPS, ms per MSCO part incl. OnGUI, GC, hook calls), -msco-perf start option - Console "fsmdump <text>" / -msco-dump: PlayMaker FSMs and hinges to MSCO\fsmdump.txt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+26
-2
@@ -11,8 +11,32 @@ namespace MSCO
|
||||
public const string MenuScene = "MainMenu";
|
||||
public const string GameScene = "GAME";
|
||||
|
||||
public static bool InMenu { get { return Application.loadedLevelName == MenuScene; } }
|
||||
public static bool InGame { get { return Application.loadedLevelName == GameScene; } }
|
||||
public static bool InMenu { get { return Scene == MenuScene; } }
|
||||
public static bool InGame { get { return Scene == GameScene; } }
|
||||
|
||||
static string scene;
|
||||
static int sceneFrame = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Aktuelle Szene, einmal pro Bild gelesen: Application.loadedLevelName erzeugt bei jedem Aufruf einen neuen String
|
||||
/// (Müll für den Garbage Collector), und InGame/InMenu werden pro Bild sehr oft abgefragt.
|
||||
/// </summary>
|
||||
public static string Scene
|
||||
{
|
||||
get
|
||||
{
|
||||
int frame = Time.frameCount;
|
||||
if (frame != sceneFrame || scene == null)
|
||||
{
|
||||
sceneFrame = frame;
|
||||
scene = Application.loadedLevelName;
|
||||
}
|
||||
return scene;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Nach einem Szenenwechsel (OnLevelWasLoaded) neu lesen.</summary>
|
||||
public static void SceneChanged() { scene = null; }
|
||||
|
||||
static readonly MethodInfo switchState =
|
||||
typeof(Fsm).GetMethod("SwitchState", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
||||
Reference in New Issue
Block a user