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
 // 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)
 {
     finishEating = false;
     astar        = animator.GetComponent <AStarNavigation>();
     wormFSM      = animator.GetComponent <WormFSM>();
     astar.ChangeGoalPosition(wormFSM.foodAgent.transform.position);
     astar.Speed = wormFSM.chaseSpeed;//Increase speed
 }
Esempio n. 3
0
    // Start is called before the first frame update
    void Start()
    {
        AddSoundObject();

        astar             = this.GetComponent <AStarNavigation>();
        audio             = this.GetComponent <AudioSource>();
        audio.loop        = true;
        audio.minDistance = maxSoundRadius;
    }
Esempio n. 4
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. 5
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)
 {
     GovFSM           = animator.GetComponent <GovForceFSM>();
     astar            = animator.GetComponent <AStarNavigation>();
     astar.stopRadius = astar.initialstopRadius;//set to the original stopRadius
     visibleTarget    = GovFSM.GetFirstVisibleObject(GovFSM.EnemyAspects);
     if (visibleTarget != null)
     {
         //Transition to Chase
         animator.SetBool("EnemyLost", false);
     }
 }
Esempio n. 6
0
    // OnStateEnter is called before OnStateEnter is called on any state inside this state machine
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        animator.SetBool("EnemyLost", false);
        astar  = animator.GetComponent <AStarNavigation>();
        GovFSM = animator.GetComponent <GovForceFSM>();

        //set stopping distance to shooting stop distance
        astar.stopRadius = GovFSM.startShootingRange;
        visibleTarget    = GovFSM.GetFirstVisibleObject(GovFSM.EnemyAspects);
        //Check if there is a visible object with this aspect & proceed to chase
        if (visibleTarget != null)
        {
            astar.ChangeGoalPosition(visibleTarget.transform.position);
        }
    }
Esempio n. 7
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)
 {
     //set enemy not lost
     animator.SetBool("EnemyLost", false);
     GovFSM          = animator.GetComponent <GovForceFSM>();
     astar           = animator.GetComponent <AStarNavigation>();
     astar.isStopped = true;//activate astar
     ResetShootTimer(GovFSM);
     visibleTarget = GovFSM.GetFirstVisibleObject(GovFSM.EnemyAspects);
     if (visibleTarget != null)
     {
         TurnToTarget(animator, visibleTarget, GovFSM);
         FireProjectile(animator);
     }
     else
     {
         //Transition to LastKnownPosition
         animator.SetBool("InShootRange", false);
         astar.isStopped = false;//deactivate astar
     }
 }
Esempio n. 8
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>();
     animator.SetBool("WayPointReached", true);
 }
Esempio n. 9
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>();
     wormFSM = animator.GetComponent <WormFSM>();
 }
Esempio n. 10
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>();
     GovFSM = animator.GetComponent <GovForceFSM>();
     EnemyFoundCheck(animator);
 }
Esempio n. 11
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>();
     hitFSM.NextContract();
 }
Esempio n. 12
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>();
     waypoint = astar.goalPos.GetComponent <Waypoint>();
 }