Esempio n. 1
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     astar         = animator.GetComponent <AStarNavigation>();
     hitFSM        = animator.GetComponent <HitmanFSM>();
     visibleTarget = hitFSM.GetVisibleTargetObject();
     if (visibleTarget != null)
     {
         //transition to assassinate
         animator.SetBool("FoundTarget", true);
     }
 }
Esempio n. 2
0
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     visibleTarget = hitFSM.GetVisibleTargetObject();
     if (visibleTarget != null)
     {
         //transition to assassinate
         animator.SetBool("FoundTarget",true);
     }
     else if (animator.GetBool("ReachedWayPoint"))
     {
         //Change search destination
         astar.ChangeGoalPosition(waypoint.GetRandomDestination());
         //transition to Hitman Search State
         animator.SetBool("ReachedWayPoint", false);
     }
     if (!hitFSM.GetContractObject().activeSelf)
     {
         //transition to new contract
         animator.SetBool("IsTargetDead", true);
     }
 }
Esempio n. 3
0
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     visibleTarget = hitFSM.GetVisibleTargetObject();
     if (visibleTarget != null)
     {
         //transition to assassinate
         animator.SetBool("FoundTarget", true);
     }
     else if (astar.reachedGoal)
     {
         //transition to Set New Location
         animator.SetBool("ReachedWayPoint", true);
     }
     //Check if chasing target & being chased & have smoke grenades available
     if (hitFSM.isBeingChased)
     {
         hitFSM.CreateSmokeBubble();
     }
     if (!hitFSM.GetContractObject().activeSelf)
     {
         //transition to new contract
         animator.SetBool("IsTargetDead", true);
     }
 }