private void OnValidate() { Transform hud = transform.Find(HudName); if (hud == null) { Debug.LogError(transform.name + " should contain transform with name \"" + HudName + "\""); } else { hudController = hud.GetComponent <ControllerHud>(); if (hudController == null) { Debug.LogError(hud.name + " should contain controller"); } } Transform mainMenu = transform.Find(MainMenuName); if (mainMenu == null) { Debug.LogError(transform.name + " should contain transform with name \"" + MainMenuName + "\""); } else { mainMenuController = mainMenu.GetComponent <ControllerMainMenu>(); if (mainMenuController == null) { Debug.LogError(mainMenu.name + " should contain controller"); } } }
/// <summary> /// ALL Player Input checking starts here. /// </summary> public override void ApplyInput(BaseGameModel model, UserInput userInput) { base.ApplyInput(model, userInput); GameModel m = model as GameModel; GameWorld world = m.World; switch (world.StatePrimary) { case GameStatePrimary.MainMenu: ControllerMainMenu.ApplyInput(m, userInput); break; case GameStatePrimary.CoreGamePlay: ControllerCoreGameplay.ApplyInput(m, userInput); break; } // Also check for Debug key presses ControllerDebug.ApplyInput(m, userInput); }