Example #1
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        _freqencyTimer = (Timer)GetNode("FrequencyTimer");
        _durationTimer = (Timer)GetNode("DurationTimer");
        _shakeTween    = (Tween)GetNode("ShakeTween");

        random  = new RandomNumberGenerator();
        Current = true;
    }
Example #2
0
    public override void _Ready()
    {
        _line = (Line2D)GetNode("Line");

        _line.Gradient = _gradientColor;
        _line.ClearPoints();

        _random = new Godot.RandomNumberGenerator();

        _tween = (Tween)GetNode("Decray");

        _line.GlobalPosition = Vector2.Zero;
        _line.GlobalRotation = 0;
        _line.Width          = _width;
    }
Example #3
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        buildObstacles();

        random     = new RandomNumberGenerator();
        gameStates = (GameStates)GetNode("/root/GAMESTATES");

        Navigation2D navigation2D = (Navigation2D)GetNode("Navigation2D");

        Input.SetCustomMouseCursor(GD.Load("res://assets/ui/blue_cross.png"), Input.CursorShape.Arrow, new Vector2(16, 16));
        //  AudioManager audioManager = (AudioManager)GetNode("/root/AUDIOMANAGER");
        //  audioManager.playMusic(musicClip);

        // After receiving and fully decoding a new snapshot, apply it to the game world
        this.Connect(nameof(SnapshotReceivedSignal), this, nameof(applySnapshot));

        network = (Network)GetNode("/root/NETWORK");
        network.Connect("DisconnectedSignal", this, nameof(onDisconnected));

        if (GetTree().IsNetworkServer())
        {
            network.Connect("PlayerRemovedSignal", this, "onPlayerRemoved");
        }

        // Spawn the players
        if (GetTree().IsNetworkServer())
        {
            aStarSolver = new RaycastAStar();
            spwanPlayer(convertToString(network.gamestateNetworkPlayer, 1));
            // The amount doesn't matter because it will be calculated in the function body
            syncBots(-1);
        }
        else
        {
            RpcId(1, nameof(spwanPlayer), convertToString(network.gamestateNetworkPlayer, -1));
        }
    }