Exemplo n.º 1
0
    public override void _Ready()
    {
        //Load the music scene that contains all the songs
        musicScene = ResourceLoader.Load("res://Scenes/Music.tscn") as PackedScene;
        music      = musicScene.Instance();
        AddChild(music);
        //Load hte sfx scene that contains all the sfx
        sfxScene = ResourceLoader.Load("res://Scenes/Sfx.tscn") as PackedScene;
        sfx      = sfxScene.Instance();
        AddChild(sfx);

        //Register the hit event for sound feedback on triggering
        HitEvent.RegisterListener(Hit);
        //Register to the rest of the events that could use sounds as quees
    }
Exemplo n.º 2
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     HitEvent.RegisterListener(OnHit);
 }