Exemplo n.º 1
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     cantidadDeCubos  = GetNode <Label>("Control/CenterContainer2/cantidad_de_cubos");
     posicionInicial  = GetNode <Position3D>("posicion_inicial_cubos");
     TimerHacerStatic = (Godot.Timer)GetTree().GetNodesInGroup("TimerHacerStatic")[0];
     fps = GetNode <Label>("Control/VBoxContainer/FPS");
 }
Exemplo n.º 2
0
 public override void _Ready()
 {
     messageLabel = GetNode("MessageLabel") as Label;
     scoreLabel   = GetNode("ScoreLabel") as Label;
     messageTimer = GetNode("MessageTimer") as Godot.Timer;
     startButton  = GetNode("StartButton") as Button;
 }
Exemplo n.º 3
0
 public override void _EnterTree()
 {
     Watermap   = GetNode <TileMap>("Watermap");
     Oilmap     = GetNode <TileMap>("Oilmap");
     TimerWater = GetNode <Timer>("TimerWater");
     TimerOil   = GetNode <Timer>("TimerOil");
     listMap.Add(Type.Water, Watermap);
     listMap.Add(Type.Oil, Oilmap);
 }
Exemplo n.º 4
0
        // Called when the node enters the scene tree for the first time.
        public override void _Ready()
        {
            Start          = GD.Load <PackedScene>("res://Game/Start.tscn");
            RunnerDetector = GetNode <Area2D>("RunnerDetector");
            DeathLaser     = GetNode <Node2D>("Beam");
            BatchTimer     = GetNode <Godot.Timer>("BatchTimer");

            Reset();
        }
Exemplo n.º 5
0
        private async void ScheduleCleanUnusedResources()
        {
            if (CleanTimer == null)
            {
                CleanTimer = new Godot.Timer()
                {
                    WaitTime = CleanInterval,
                };

                await ToSignal(CleanTimer, "timeout");

                CleanUnusedResources();
                CleanTimer = null;
            }
        }
Exemplo n.º 6
0
    private void OnPlayerDeath()
    {
        _musicPlayer.Stream = _gameOverMusic;
        _musicPlayer.Play();
        _wizzard.OnPlayerDeath();
        _monsterSpawnTimer.Stop();
        var timer = new Timer
        {
            OneShot   = true,
            Autostart = true,
            WaitTime  = 2
        };

        timer.Connect("timeout", this, nameof(GameOver));
        AddChild(timer);
    }
Exemplo n.º 7
0
 public override void _Ready()
 {
     _rand.Randomize();
     _hud               = GetNode <HUD>("HUD");
     _arena             = GetNode <Arena>("../Arena");
     _wizzard           = GetNode <Wizzard>("../Friend/Wizzard");
     _playerSpawner     = GetNode <Node2D>("PlayerSpawner");
     _musicPlayer       = GetNode <AudioStreamPlayer>("MusicPlayer");
     _player            = SpawnPlayer();
     _monsterSpawnTimer = new Timer
     {
         OneShot   = false,
         Autostart = true,
         WaitTime  = 2f
     };
     _monsterSpawnTimer.Connect("timeout", this, nameof(SpawnMonster));
     AddChild(_monsterSpawnTimer);
     _musicPlayer.Stream = _dungeonMusic;
     _musicPlayer.Play();
 }
Exemplo n.º 8
0
    public override void _Ready()
    {
        ship = GetNode("PlayerShip") as ShipObject;
        Position2D temp = GetNode("PlayerShipPoints/2") as Position2D;

        commandStartPoint     = GetNode("CommandPanel/CommandStartPoint") as Position2D;
        commandExecutionPoint = GetNode("CommandPanel/CommandExecutionPoint") as CommandExecutionPointObject;
        reefSpawnTimer        = GetNode("ReefSpawnTimer") as Timer;
        reefPool             = GetNode("ReefPool") as Node;
        remainingNMileLabel  = GetNode("CommandPanel/RemainingNMileLabel") as Label;
        messageLabel         = GetNode("MessageLabel") as Label;
        messageTimer         = GetNode("MessageTimer") as Godot.Timer;
        weaterStatusLabel    = GetNode("CommandPanel/WeaterStatusLabel") as Label;
        gameOverSound        = GetNode("GameOverSound") as AudioStreamPlayer;
        missionCompleteSound = GetNode("MissionCompleteSound") as AudioStreamPlayer;
        bgm = GetNode("BGM") as AudioStreamPlayer;

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

        this.globals.Randomize();
        ship.SetStartPosition(temp.Position, Int32.Parse(temp.Name));
        velocity = commandVelocity[weatherFactor];
        reefSpawnTimer.Start();
        distanceFromGoal            *= 60; //multiply with 60 because frame-per-sec principle
        this.globals.missionComplete = false;
        difficult     = 0;
        weatherFactor = 0;
        messageLabel.Hide();
        messageTimer.Stop();
        SetWeatherStatusLabel();
        gameOverSound.Stop();
        missionCompleteSound.Stop();
        bgm.Stop();
        bgm.Play();

        commandExecutionPoint.Connect("CallRight", this, "ForceShipTurnRight");
        commandExecutionPoint.Connect("CallLeft", this, "ForceShipTurnLeft");
        ship.Connect("Hit", this, "DoGameOver");
    }
Exemplo n.º 9
0
 public override void _EnterTree()
 {
     isPlaced = true;
     timer    = GetNode <Timer>("Timer");
 }