public void explode()
    {
        CollisionShape2D collisionShape2D = (CollisionShape2D)GetNode("CollisionShape2D");

        collisionShape2D.CallDeferred("set", "disabled", true);

        Sprite icon = (Sprite)GetNode("Icon");

        icon.Hide();

        AnimatedSprite animatedSprite = (AnimatedSprite)GetNode("Explosion");

        animatedSprite.Show();
        animatedSprite.Play("smoke");

        AudioManager audioManager = (AudioManager)GetNode("/root/AUDIOMANAGER");

        audioManager.playSoundEffect(explosionMusicClip);
    }
Esempio n. 2
0
    public void explode()
    {
        CollisionShape2D collisionShape2D = (CollisionShape2D)GetNode("CollisionShape2D");

        collisionShape2D.CallDeferred("set", "disabled", true);

        Sprite icon = (Sprite)GetNode("Icon");

        icon.Hide();

        AnimatedSprite animatedSprite = (AnimatedSprite)GetNode("Explosion");

        animatedSprite.Show();
        animatedSprite.Play("fire");

        RemainParticles remainParticles = (RemainParticles)((PackedScene)GD.Load("res://effects/RemainParticles.tscn")).Instance();

        remainParticles.GlobalPosition = this.GlobalPosition;
        GetParent().GetParent().GetNode("RemainEffectManager").AddChild(remainParticles);

        AudioManager audioManager = (AudioManager)GetNode("/root/AUDIOMANAGER");

        audioManager.playSoundEffect(explosionMusicClip);
    }