Beispiel #1
0
    private void SwitchToNextNonEmptyAmmo(PlanetViewController planet)
    {
        if (planet.GetCurrentAmmo() > 0)
        {
            return;
        }
        var rocketTypeInt = (int)planet.GetCurrentRocketSettings().rocketType;

        for (var i = 0; i < Enum.GetValues(typeof(RocketType)).Length; i++)
        {
            rocketTypeInt++;
            if (rocketTypeInt >= Enum.GetValues(typeof(RocketType)).Length)
            {
                rocketTypeInt = 0;
            }

            planet.SetRocketType((RocketType)rocketTypeInt);
            if (planet.GetCurrentAmmo() <= 0)
            {
                continue;
            }

            break;
        }
    }
Beispiel #2
0
    private void ChooseRocketType(PlanetViewController enemy, Transform target)
    {
        var dist = Vector3.Distance(enemy.transform.position, target.position);

        if (dist > enemy.GetOrbit())
        {
            enemy.SetRocketType(RocketType.Fast);
        }
        else if (dist < DISTANCE_TO_SHOT_DEADLY_WEAPON)
        {
            enemy.SetRocketType(RocketType.Deadly);
        }
        else
        {
            enemy.SetRocketType(RocketType.Normal);
        }

        SwitchToNextNonEmptyAmmo(enemy);
    }