示例#1
0
    /// <summary>
    /// 站立的时间是否超过这个长度
    /// </summary>
    /// <param name="overTime"></param>
    /// <returns></returns>
    public bool ConditionIsStandingOverrideTime(float overTime)
    {
        if (RunningProperty.AI.Machine.CurrentState.Id != BehaviourMachine.State.STAND)
        {
            return(false);
        }

        BehaviourStandFiniteState standState = RunningProperty.AI.Machine.CurrentState as BehaviourStandFiniteState;

        if (standState == null)
        {
            return(false);
        }

        if (standState.StatingDuration >= overTime)
        {
            return(true);
        }

        return(false);
    }
示例#2
0
    public BehaviourMachine(BehaviourAI ai)
    {
        mAI = ai;

        mStandState       = new BehaviourStandFiniteState(ai.RunningProperty);
        mWalkState        = new BehaviourWalkFiniteState(ai.RunningProperty);
        mAttackState      = new BehaviourAttackFiniteState(ai.RunningProperty);
        mRunState         = new BehaviourRunFiniteState(ai.RunningProperty);
        mChaseTargetState = new BehaviourChaseTargetFiniteState(ai.RunningProperty);
        mPatrolState      = new BehaviourPatrolFiniteState(ai.RunningProperty);
        mFollowState      = new BehaviourFollowFiniteState(ai.RunningProperty);
        mEmptyState       = new BehaviourEmptyFiniteState(ai.RunningProperty);
        mEscapeState      = new BehaviourEscapeFiniteState(ai.RunningProperty);

        mMachine.AddState(State.WALK, mWalkState);
        mMachine.AddState(State.RUN, mRunState);
        mMachine.AddState(State.STAND, mStandState);
        mMachine.AddState(State.ATTACK, mAttackState);
        mMachine.AddState(State.CHASETARGET, mChaseTargetState);
        mMachine.AddState(State.PATROL, mPatrolState);
        mMachine.AddState(State.FOLLOW, mFollowState);
        mMachine.AddState(State.EMPTY, mEmptyState);
        mMachine.AddState(State.ESCAPE, mEscapeState);
    }