Example #1
0
    public void ChangeState(AIState targetState)
    {
        aiState    = targetState;
        everyFrame = null;
        lateFrame  = null;
        llateFrame = null;
        switch (targetState)
        {
        case AIState.idle:
            lateFrame = IdleBehaviours;
            break;

        case AIState.lateIdle:
            llateFrame = IdleBehaviours;
            break;

        case AIState.inRadius:
            lateFrame = InRadiusBehaviours;
            break;

        case AIState.inView:
            lateFrame  = InRadiusBehaviours;
            everyFrame = InViewBehaviours;
            break;

        default:
            break;
        }
    }
Example #2
0
        public void ChangeState(AIState targetState)
        {
            aiState       = targetState;
            everyFrame    = null;
            lateFrame     = null;
            latelateFrame = null;

            switch (targetState)
            {
            case AIState.idle:
                lateFrame = IdleBehaviours;
                break;

            case AIState.lateIdle:
                latelateFrame = IdleBehaviours;
                break;

            case AIState.inRadius:
                lateFrame = InRadiusBehaviours;
                break;

            case AIState.inView:
                lateFrame         = InRadiusBehaviours;
                latelateFrame    += MonitorTargetPosition;
                everyFrame       += InViewBehaviours;
                lastKnownPosition = playerTarget.position; // Will help cut down the number of times a new path is created.
                MoveToPosition(lastKnownPosition);         //If we disable this, the AI will maintain the patrol but constantly watch the player.
                break;

            default:
                break;
            }
        }
Example #3
0
    public void ChangeState(AIState targetState)
    {
        aiState       = targetState;
        everyFrame    = null;
        lateFrame     = null;
        latelateFrame = null;
        everyFrame    = MonitorPosition;

        switch (targetState)
        {
        case AIState.idle:
            lateFrame = IdleBehaviours;
            break;

        case AIState.lateIdle:
            latelateFrame = IdleBehaviours;
            break;

        case AIState.inRadius:
            lateFrame = InRadiusBehaviours;
            break;

        //Anything commented here was for the Navmesh which will be implemented later.
        case AIState.inView:
            lateFrame = InRadiusBehaviours;
            //latelateFrame += MonitorTargetPosition;
            latelateFrame = MonitorPlayerPosition;
            everyFrame   += InViewBehaviours;
            everyFrame   += MovementActual;
            // = playerTarget.position; // Will help cut down the number of times a new path is created.
            //MoveToPosition(lastKnownPosition);
            lastKnownPosition = playerTarget.position;
            MoveToTarget(playerTarget.position);
            break;

        default:
            break;
        }
    }