//Run when the recording starts up public override void Init() { //Regestrations for the events needed for the scene =========================================================== InputCallbackEvent.RegisterListener(GrabInput); MouseInputCallbackEvent.RegisterListener(GrabMouseInput); //============================================================================================================= //Preload the scenes for the state to be used ================================================================= //Load the map resource scene and instance it as a child of the GameProgramState node mapScene = ResourceLoader.Load("res://Scenes/Map.tscn") as PackedScene; map = mapScene.Instance(); AddChild(map); TileMap RealMap = GetNode <TileMap>("Map/RealMap"); RealMap.QueueFree(); displayMap = GetNode <TileMap>("Map/ProgramMap"); displayMap.Visible = true; playerScene = ResourceLoader.Load("res://Scenes/Player.tscn") as PackedScene; //============================================================================================================= //Set the ui state to the programming hud ===================================================================== SendUIEvent suiei = new SendUIEvent(); suiei.uiState = UIState.PROGRAMMING_HUD; suiei.FireEvent(); //============================================================================================================= //Grab the time the program started recording the time for hte user input timerStarted = OS.GetTicksMsec(); BuildMap(); //Set up the camera follow for hte player CameraEvent cei = new CameraEvent(); cei.target = (Node2D)player; cei.FireEvent(); }
private void Init() { //Instance the game state manager and add it as a child to the main scene GameStateManagerNode = GameStateManagerScene.Instance(); AddChild(GameStateManagerNode); //Instance the camera for the main scene and add it to the main scene as a child camera = camerScene.Instance(); AddChild(camera); //States for the games recording mechanic ------------------------------- gameEmptyState = GameEmptyStateScene.Instance(); gameWaitState = GameWaitStateScene.Instance(); gameProgramState = GameProgramStateScene.Instance(); gameRunState = GameRunStateScene.Instance(); gameStateManager = GetNode <GameStateManager>("GameStateManager"); //Init the ui state manager to the menu state gameStateManager.Init(gameEmptyState); //The UI of the game ui = uiScene.Instance(); AddChild(ui); //At the begining of hte program set the ui state to the menu ui elemenet SendUIEvent suiei = new SendUIEvent(); suiei.uiState = UIState.MENU; suiei.FireEvent(); }
//Run when the state starts up public override void Init() { //Set the ui state to the wait hud state SendUIEvent suiei = new SendUIEvent(); suiei.uiState = UIState.WAIT_HUD; suiei.FireEvent(); }
private void WinGame(WinEvent wei) { gameStateManager.ChangeState(gameEmptyState); SendUIEvent suiei = new SendUIEvent(); suiei.uiState = UIState.WIN; suiei.FireEvent(); }
private void ShowWinScreen(WinEvent wei) { HideAll(); winScreen.Show(); SendUIEvent suiei = new SendUIEvent(); suiei.showWinScreen = true; suiei.FireEvent(); }
private void ShowMenu() { HideAll(); menu.Show(); SendUIEvent suiei = new SendUIEvent(); suiei.showMenu = true; suiei.FireEvent(); }
private void LoseGame(DeathEvent dei) { if (dei.target.IsInGroup("Player")) { gameStateManager.ChangeState(gameEmptyState); SendUIEvent suiei = new SendUIEvent(); suiei.uiState = UIState.LOSE; suiei.FireEvent(); } }
private void RunPressed(RunEvent rei) { gameStateManager.ChangeState(gameRunState); //At the begining of hte program set the ui state to the menu ui elemenet SendUIEvent suiei = new SendUIEvent(); suiei.uiState = UIState.RUN_HUD; suiei.FireEvent(); }
private void ShowUI() { HideAll(); ui.Show(); SendUIEvent suiei = new SendUIEvent(); suiei.showUI = true; suiei.startGame = true; suiei.FireEvent(); }
private void ShowDeathScreen(DeathEvent dei) { if (dei.target.IsInGroup("Player")) { HideAll(); DeathScreen.Show(); SendUIEvent suiei = new SendUIEvent(); suiei.showDeathScreen = true; suiei.FireEvent(); } }