// Called when the node enters the scene tree for the first time. public override void _Ready() { UnitDeathEvent.RegisterListener(UnitDeath); WinEvent.RegisterListener(WinTriggered); LoseEvent.RegisterListener(LoseTriggered); //Grab all the references for the scenes menuPanel = GetNode <Node2D>("Menu"); winPanel = GetNode <Node2D>("Win"); losePanel = GetNode <Node2D>("Lose"); creditsPanel = GetNode <Node2D>("Credits"); uiPanel = GetNode <Node2D>("UI"); background = GetNode <Sprite>("Background"); //Grab a refference to all the buttons that we have startBtn = GetNode <Button>("Start"); exitBtn = GetNode <Button>("Exit"); menuBtn = GetNode <Button>("Menubtn"); smallExitBtn = GetNode <Button>("SmallExit"); creditsBtn = GetNode <Button>("Creditsbtn"); //The buttons for the menu startBtn.Connect("pressed", this, nameof(ShowUI)); exitBtn.Connect("pressed", this, nameof(ExitGame)); menuBtn.Connect("pressed", this, nameof(ShowMenu)); smallExitBtn.Connect("pressed", this, nameof(ExitGame)); creditsBtn.Connect("pressed", this, nameof(ShowCredits)); //Hide all the scenes at start up HideAll(); ShowMenu(); }
// Called when the node enters the scene tree for the first time. public override void _Ready() { WinEvent.RegisterListener(ShowWin); GameOverEvent.RegisterListener(ShowGameOver); menu = GetNode <VBoxContainer>("Menu"); win = GetNode <VBoxContainer>("Win"); gameOver = GetNode <VBoxContainer>("GameOver"); ShowMenu(); }
//================================================================================================================= // Called when the node enters the scene tree for the first time. public override void _Ready() { //The events from the UI GetUIEvent.RegisterListener(GetUIInput); //Regestiring the events for the game states RunEvent.RegisterListener(RunPressed); WinEvent.RegisterListener(WinGame); DeathEvent.RegisterListener(LoseGame); Load(); Init(); }
public override void _Ready() { WinEvent.RegisterListener(ShowWinScreen); DeathEvent.RegisterListener(ShowDeathScreen); //Grab a refference to all the ui screens for hte game ui = GetNode <Node2D>("UI"); menu = GetNode <Node2D>("Menu"); winScreen = GetNode <Node2D>("WinScreen"); DeathScreen = GetNode <Node2D>("DeathScreen"); //Hide all the screens for the game HideAll(); //Show the menu screen at startup ShowMenu(); }
// Called when the node enters the scene tree for the first time. public override void _Ready() { //Pre load the scenes for the game playerScene = ResourceLoader.Load("res://Scenes/Player.tscn") as PackedScene; mapScene = ResourceLoader.Load("res://Scenes/Map.tscn") as PackedScene; enemyScene = ResourceLoader.Load("res://Scenes/Enemy.tscn") as PackedScene; artifactScene = ResourceLoader.Load("res://Scenes/Artifact.tscn") as PackedScene; uiScene = ResourceLoader.Load("res://Scenes/UI.tscn") as PackedScene; //The UI of the game ui = uiScene.Instance(); AddChild(ui); SendUIEvent.RegisterListener(StartGame); DeathEvent.RegisterListener(LoseGame); WinEvent.RegisterListener(WinGame); }
// Called when the node enters the scene tree for the first time. public override void _Ready() { //Grabs the map scene from the Scene tree on the games start up mapScene = ResourceLoader.Load("res://Scenes/Map.tscn") as PackedScene; playerScene = ResourceLoader.Load("res://Scenes/Player.tscn") as PackedScene; crystalScene = ResourceLoader.Load("res://Scenes/Crystal.tscn") as PackedScene; enemySpawnerScene = ResourceLoader.Load("res://Scenes/EnemySpawner.tscn") as PackedScene; UIScene = ResourceLoader.Load("res://Scenes/UI.tscn") as PackedScene; missilePickupScene = ResourceLoader.Load("res://Scenes/MissilePickup.tscn") as PackedScene; MainEvent.RegisterListener(UIEventFired); UnitDeathEvent.RegisterListener(EndGame); WinEvent.RegisterListener(WinTriggered); LoseEvent.RegisterListener(LostTriggered); ui = UIScene.Instance(); ui.Name = "UI"; AddChild(ui); }
public override void _ExitTree() { SendUIEvent.UnregisterListener(StartGame); DeathEvent.UnregisterListener(LoseGame); WinEvent.RegisterListener(WinGame); }