// 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) { if (PAI == null) { PAI = animator.GetComponent <PoacherAI>(); } }
// Update is called once per frame void Update() { if (!damagedTreeFound) { allTrees = FindObjectsOfType <TreeControl>(); foreach (TreeControl t in allTrees) { if (t.IsPlanted && t.CurrentHealth < t.maxHealth) { tree = t; damagedTreeFound = true; StartHealTut(); break; } } } if (!healFinished && damagedTreeFound) { if (tree.CurrentHealth == tree.maxHealth) { healFinished = true; FinishHealTut(); } } if (!poacherFound) { GameObject p = GameObject.FindGameObjectWithTag("Poacher"); if (p != null) { firstPoacher = p.GetComponent <PoacherAI>(); poacherFound = true; } } if (!revealStarted && poacherFound) { if (firstPoacher.IsHiding) { StartRevealTut(); revealStarted = true; } } if (!revealFinished && revealStarted) { if (!firstPoacher.IsHiding) { FinishRevealTut(); revealFinished = true; } } if (revealFinished && healFinished) { DisableAllPlayerTut(); this.enabled = false; } }
// 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) { if (PAI == null) { PAI = animator.GetComponent <PoacherAI>(); } PAI.Camouflage(); waitTime = Random.Range(5f, 10f); }
// 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) { if (navAgent == null) { navAgent = animator.GetComponent <NavMeshAgent>(); } if (PAI == null) { PAI = animator.GetComponent <PoacherAI>(); } PAI.FindHidePosition(); }
// 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) { if (navAgent == null) { navAgent = animator.GetComponent <NavMeshAgent>(); } if (PAI == null) { PAI = animator.GetComponent <PoacherAI>(); } //set the navmesh agent target currTargetDest = PAI.CurrTargetDest; navAgent.SetDestination(currTargetDest); }
// 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) { if (PAI == null) { PAI = animator.GetComponent <PoacherAI>(); } if (navAgent == null) { navAgent = animator.GetComponent <NavMeshAgent>(); } navAgent.enabled = true; timer = 0f; }
// 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) { if (navAgent == null) { navAgent = animator.GetComponent <NavMeshAgent>(); } if (pAI == null) { pAI = animator.GetComponent <PoacherAI>(); } navAgent.speed += speedIncrease; isDestroyed = false; FindFleeDestination(animator); }