Exemple #1
0
    private void _onCapturableBaseBodyEntered(Node2D body)
    {
        if (body.HasMethod(nameof(Agent.GetCurrentTeam)))
        {
            Agent agent = (Agent)body;
            agentsEntered[(int)agent.GetCurrentTeam()] = (int)agentsEntered[(int)agent.GetCurrentTeam()] + 1;

            checkIsBaseCaptured();
        }
    }
Exemple #2
0
    public void _onPickupBodyEntered(Node2D body)
    {
        AudioManager audioManager = (AudioManager)GetNode("/root/AUDIOMANAGER");

        audioManager.playSoundEffect(musicClip);

        if (body.HasMethod(nameof(Agent.Heal)))
        {
            Agent agent = (Agent)body;
            _inventoryManager.AddItem(_itemResource, agent.GetInventory());
        }

        QueueFree();
    }
Exemple #3
0
    public void _onPickupBodyEntered(Node2D body)
    {
        AudioManager audioManager = (AudioManager)GetNode("/root/AUDIOMANAGER");

        audioManager.playSoundEffect(musicClip);

        if (type == Items.health)
        {
            if (body.HasMethod("heal"))
            {
                Tank tank = (Tank)body;
                tank.heal((int)GD.RandRange(amount.x, amount.y));
            }
        }
        if (type == Items.ammo)
        {
            if (body.HasMethod("ammoIncrease"))
            {
                Tank tank = (Tank)body;
                tank.ammoIncrease(Weapon.WeaponAmmoType.bullet, (int)GD.RandRange(amount.x, amount.y));
            }
        }
        QueueFree();
    }
 private void _on_DetectRadius_body_entered(Node2D body)
 {
     if (body.HasMethod("getTeamIdentifier"))
     {
         // If not same team identifier, identify as target
         if (((Tank)body).getTeamIdentifier() != getTeamIdentifier())
         {
             target = body;
         }
         else
         {
             // Join as member
             members.Add((Tank)body);
         }
     }
 }