Ejemplo n.º 1
0
    public virtual void GiveWeapon(TankWeapon weapon)
    {
        int activeTurrets = 1;

        for (int i = 1; i < turrets.Count; i++)
        {
            if (turrets[i].gameObject.activeInHierarchy && turrets[i].weaponHolder.weapon == null)
            {
                activeTurrets++;
                turrets[i].GiveWeapon(weapon);
                return;
            }
        }
        TurretController randomTurret = turrets[UnityEngine.Random.Range(0, activeTurrets)];

        randomTurret.GiveWeapon(weapon);
    }