add some signals to the event bus
This commit is contained in:
parent
b63cd81c2f
commit
d5a6585999
@ -1,20 +0,0 @@
|
|||||||
using Godot;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
public class Event : Node
|
|
||||||
{
|
|
||||||
[Signal]
|
|
||||||
delegate void GameStarted(string example);
|
|
||||||
|
|
||||||
public override void _Ready()
|
|
||||||
{
|
|
||||||
var events = (Event) GetNode("/root/Event");
|
|
||||||
events.Connect("GameStarted", this, "MyCallBack");
|
|
||||||
|
|
||||||
events.EmitSignal("GameStarted", " my extra string");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MyCallBack(string example) {
|
|
||||||
GD.Print("signal worked" + example);
|
|
||||||
}
|
|
||||||
}
|
|
15
scripts/Event.cs
Normal file
15
scripts/Event.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
public sealed class Event : Node
|
||||||
|
{
|
||||||
|
[Signal]
|
||||||
|
delegate void EnergyCollected(int energy);
|
||||||
|
[Signal]
|
||||||
|
delegate void BoltCollected(int bolt);
|
||||||
|
[Signal]
|
||||||
|
delegate void InvincibilityCollected();
|
||||||
|
[Signal]
|
||||||
|
delegate void FireCollected();
|
||||||
|
[Signal]
|
||||||
|
delegate void PlayerTouched();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user