Exemplo n.º 1
0
    public override void _Ready()
    {
        asteroidPool      = GetNode("AsteroidPool") as Node;
        commandStartPoint = GetNode("CommandStartPoint") as Position2D;
        deathSound        = GetNode("DeathSound") as AudioStreamPlayer;
        bgm                 = GetNode("BGM") as AudioStreamPlayer;
        gameplayHUD         = GetNode("GameplayHUD") as GameplayHUDObject;
        gameOverHUD         = GetNode("GameOverHUD") as GameOverHUD;
        ship                = GetNode("Ship") as ShipObject;
        commandExecutePoint = GetNode("CommandExecutePoint") as CommandExecutePoint;

        messageTimer  = GetNode("GameplayHUD/MessageTimer") as Timer;
        blackHolePool = GetNode("BlackHolePool") as Node;
        spawnTimer    = GetNode("SpawnTimer") as Timer;

        this.globals = (Autoload)GetNode("/root/Autoload");

        this.globals.Randomize();
        ship.Connect("Hit", this, "GameOver");
        gameOverHUD.Connect("BackToMainMenu", this, "GotoMainmenu");
        gameOverHUD.Connect("RestartGame", this, "RestartGameplay");
        commandExecutePoint.Connect("CallRight", this, "ForceShipTurnRight");
        commandExecutePoint.Connect("CallLeft", this, "ForceShipTurnLeft");
        commandExecutePoint.Connect("CallShoot", this, "ForceShipShootLaser");

        SetProcess(true);
        NewGame();
        StartNextLevel();
    }
 private void GameOver()
 {
     DeGlitch();
     HUD.SetActive(false);
     GameOverHUD.SetActive(true);
 }