Ejemplo n.º 1
0
    public override void _Ready()
    {
        sprite           = GetNode <AnimatedSprite>("Sprite");
        collisionShape2D = GetNode <CollisionShape2D>("CollisionShape2D");
        bloodParticles   = GetNode <Particles2D>("BloodParticles");
        camera2D         = GetNode <Camera2D>("Camera2D");

        crunchSounds[0] = GetNode <AudioStreamPlayer2D>("sounds/CrunchSoundOne");
        crunchSounds[1] = GetNode <AudioStreamPlayer2D>("sounds/CrunchSoundTwo");
        crunchSounds[2] = GetNode <AudioStreamPlayer2D>("sounds/CrunchSoundThree");
        crunchSounds[3] = GetNode <AudioStreamPlayer2D>("sounds/CrunchSoundFour");
        moneyGained     = GetNode <AudioStreamPlayer2D>("sounds/MoneyGained");
        hitSound        = GetNode <AudioStreamPlayer2D>("sounds/HitSound");
        healSound       = GetNode <AudioStreamPlayer2D>("sounds/HealSound");
        rayCast2D       = GetNode <RayCast2D>("RayCast2D");

        healthBar = GetNode <HealthBar>("HealthBarNode");

        this.inGameUI           = GetNode <InGameUI>("Camera2D/HudLayer/UI");
        this.endGameUI          = GetNode <EndGameUI>("Camera2D/HudLayer/EndGameUI");
        this.healParticleEffect = GetNode <Particles2D>("healParticleEffect");

        this.bulletNodes = new BulletNode[maxBullets];

        for (int i = 0; i < maxBullets; i++)
        {
            BulletNode bulletInstance = (BulletNode)BulletScene.Instance();
            AddChild(bulletInstance);

            bulletNodes[i] = bulletInstance;
        }
        endGameUI.Visible = false;

        inGameUI.SetSpendingMoney(spendingMoney);
        inGameUI.SetWeaponDamage(damage);
    }
Ejemplo n.º 2
0
 public void Spend(int spend)
 {
     this.spendingMoney -= spend;
     inGameUI.SetSpendingMoney(spendingMoney);
 }