void Update() { sfxState = StaticStatesAndVariables.SfxState; bgmState = StaticStatesAndVariables.BgmState; switch (gameState) { case GameStates.Running: UIRunning.Show(); UIPause.Hide(); UIGameOver.Hide(); break; case GameStates.Paused: UIRunning.Hide(); UIPause.Show(); UIGameOver.Hide(); break; case GameStates.GameOver: UIRunning.Hide(); UIPause.Hide(); UIGameOver.Show(); break; } }
// Return the first active SFXState in the given SimSet/SimGroup. public static SFXState sfxGetActiveStateInGroup(SimGroup group) { for (uint i = 0; i < group.getCount(); i++) { SFXState obj = group.getObject(i); if (!obj.isMemberOfClass("SFXState")) { continue; } if (obj.isActive()) { return(obj); } } return("0"); }
//----------------------------------------------------------------------------- // AudioStateExclusive class. // // Automatically deactivates sibling SFXStates in its parent SimGroup // when activated. public override void onActivate() { base.onActivate(); SimGroup group = parentGroup.ID; for (uint i = 0; i < group.getCount(); i++) { SFXState obj = group.getObject(i); if (obj.getId() != this.getId() && isMemberOfClass("SFXState") && isActive()) { obj.deactivate(); } } }