Esempio n. 1
0
    // AI Segment

    public override bool AI_IsGoodToUseNow()
    {
        List <UnitScript> targets = ShootingScript.PossibleTargets(myShootingScript, transform.position);

        if (targets.Count > 0 && myUnit.CurrentHP == 1)
        {
            return(true);
        }
        foreach (UnitScript enemy in targets)
        {
            if (enemy.CurrentDefence >= 4)
            {
                return(true);
            }
        }
        return(false);
    }
Esempio n. 2
0
    public override GameObject AI_ChooseTarget()
    {
        List <UnitScript> targets = ShootingScript.PossibleTargets(myShootingScript, transform.position);
        int startingDefence       = 10;

        while (true)
        {
            if (startingDefence < -10)
            {
                Debug.LogError("This loop didn't stop for some reason");
                Log.SpawnLog("AI of Marksman went boom. Tell Dogo about it.");
                return(null);
            }
            foreach (UnitScript unit in targets)
            {
                if (unit.CurrentDefence >= startingDefence)
                {
                    return(unit.gameObject);
                }
            }
            startingDefence--;
        }
    }