Example #1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="s"></param>
    void CheckSkillDistance(AIState s)
    {
//        if(s == AIState.CHECKING_SKILL_DISTANCE)
//        {
        //Declaring local variables
        bool inRange = false;

        //Call the helper function to determine how many player unit
        //objects are within the current skill range.
        units = CheckUnitsInProximity(skillHandler.AttackRangeValue());

        if (units.Count > 0)
        {
            unitSquaredDistances = CreateListOfSquaredMagnitudes(units);
            inRange = skillHandler.IsSkillInRange(unitSquaredDistances[0]);
        }

        golemBrain.PopState();

        if (inRange)
        {
            golemBrain.PushState(AIState.EXECUTING_SKILL);
        }
        else if (isSprinting)
        {
            golemBrain.PushState(AIState.SPRINTING);
        }
        //If the above two statements are not met,
        //then go to the default state - moving
        else
        {
            skillPicked = false;
        }
//        }
    }