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>();
     //Set destination to Contract Target
     astar.ChangeGoalPosition(hitFSM.GetContractObject().transform.position);
 }
Esempio n. 2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject == hitFSM.GetContractObject())
     {
         //disable contract target
         other.gameObject.SetActive(false);
     }
 }
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)
 {
     //Check if destination is set to Contract Target
     if (astar.goalPos.position != hitFSM.GetContractObject().transform.position)
     {
         astar.goalPos.position = hitFSM.GetContractObject().transform.position;
     }
     //Check if chasing target & being chased & have smoke grenades available
     if (astar.goalPos.position == hitFSM.GetContractObject().transform.position&& hitFSM.isBeingChased)
     {
         hitFSM.CreateSmokeBubble();
     }
     if (!hitFSM.GetContractObject().activeSelf)
     {
         //transition to Set New Destination
         animator.SetBool("IsTargetDead", true);
     }
 }
Esempio n. 4
0
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     //Check if there is a new target contract
     if (hitFSM.GetContractObject() == null)
     {
         //disable hitman
         hitFSM.gameObject.SetActive(false);
     }
     else
     {
         if (animator.GetBool("IsTargetDead"))
         {
             //reset
             animator.SetBool("ReachedWayPoint", true);
             animator.SetBool("FoundTarget", false);
             //transition to Set New Destination
             animator.SetBool("IsTargetDead", false);
         }
     }
 }
Esempio n. 5
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. 6
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);
     }
 }