Beispiel #1
0
    private void ConnectAll()
    {
        foreach (Node2D node in this.GetChildren())
        {
            Spikes s = AttemptCast <Spikes>(node);
            if (s != null)
            {
                // Connect this node's NewPlayer signal to the spike's OnNewPlayer method
                this.Connect("NewPlayer", s, "OnNewPlayer");
            }

            Checkpoint c = AttemptCast <Checkpoint>(node);
            if (c != null)
            {
                // Connect the checkpoint's Activated signal to this node's OnCheckpointActivate method
                c.Connect("Activated", this, nameof(OnCheckpointActivate));
                // Add the checkpoint name to the list of checkpoint node names
                listCheckpointNodeNames.Add(c.Name);
            }

            Goalpoint g = AttemptCast <Goalpoint>(node);
            if (g != null)
            {
                // Connect the goalpoint's Activated signal to this node's OnGoalpointActivated method
                g.Connect("Activated", this, nameof(OnGoalpointActivated));
            }
        }
    }
Beispiel #2
0
    public void OnGoalpointActivated(Node entity, Goalpoint sender)
    {
        if (!this.listPlayerNodeNames.Contains(entity.Name))
        {
            return;
        }

        entity.SetPhysicsProcess(false);

        System.Threading.Thread.Sleep(10);

        EmitSignal(nameof(WinStateReached));

        // this.spawnPosition = this.startPosition.Position;
    }