예제 #1
0
        public static PatrolState Create(StateBlackboard blackboard, Animator animator, NavMeshAgent navAgent, string idleTrigger, string runTrigger, Vector3 origin, float patrolRadius, float minWaitDuration, float maxWaitDuration, out SetAnimTriggerAction walkAction, bool randomWaitDuration = false)
        {
            SetAnimTriggerAction idleAction = new SetAnimTriggerAction(blackboard, animator, idleTrigger);

            walkAction = new SetAnimTriggerAction(blackboard, animator, runTrigger);
            SetRandomDestinationAction destinationAction = new SetRandomDestinationAction(blackboard, origin, patrolRadius);
            MoveToDestinationAction    moveToAction      = new MoveToDestinationAction(blackboard, navAgent);
            TimerAction timerAction = randomWaitDuration ? new TimerAction(blackboard, minWaitDuration, maxWaitDuration) : new TimerAction(blackboard, maxWaitDuration);

            return(new PatrolState(blackboard, idleAction, timerAction, walkAction, destinationAction, moveToAction));
        }
예제 #2
0
 public PatrolState(StateBlackboard blackboard, SetAnimTriggerAction setIdleAction, TimerAction timerAction, SetAnimTriggerAction setWalkAction, SetRandomDestinationAction setDestinationAction, MoveToDestinationAction moveToAction, int priority = 0, bool repeatable = false) : base(blackboard, priority, repeatable)
 {
     actions.Add(setIdleAction);
     actions.Add(timerAction);
     actions.Add(setWalkAction);
     actions.Add(setDestinationAction);
     actions.Add(moveToAction);
 }
예제 #3
0
 public RangedAttackState(StateBlackboard blackboard, SetAnimTriggerAction idleAction, TimerAction timerAction, SetRandomDestinationAction destinationAction, SetAnimTriggerAction runAction, MoveToDestinationAction moveToAction, SetSkillAction setSkillAction, LookAtTargetAction lookAtAction, SetAnimTriggerAction attackAction, int priority = 0, bool repeatable = false) : base(blackboard, priority, repeatable)
 {
     actions.Add(idleAction);
     actions.Add(timerAction);
     actions.Add(destinationAction);
     actions.Add(runAction);
     actions.Add(moveToAction);
     actions.Add(setSkillAction);
     actions.Add(lookAtAction);
     actions.Add(attackAction);
 }