// 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) { alertBehaviour = animator.GetBehaviour <EnemyAlert>(); monster = animator.gameObject; agent = monster.GetComponent <NavMeshAgent>(); searchTimer = 5f; }
void Start() { stats = gameObject.GetComponent <EnemyStats>(); sight = gameObject.GetComponent <EnemySight>(); alert = gameObject.GetComponent <EnemyAlert>(); col = gameObject.GetComponent <SphereCollider>(); player = GameObject.FindGameObjectWithTag("Player"); debugRenderer = GetComponentInChildren <Renderer>(); stats.attackRange += GetComponent <CapsuleCollider>().bounds.size.x *0.5f; delaySet = false; collideWithOther = false; delay = stats.IDLE_DELAY; nextWaypt = 0; // 0 - original pos. (whr AI spawns/is from) // Spawn pos if (waypointList.Count > 0) { transform.position = waypointList[nextWaypt].position; transform.rotation = waypointList[nextWaypt].rotation; } // AI render color = green (!alerted) debugRenderer.material.color = Color.green; }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); bodyCol = GetComponent <CapsuleCollider>(); col = GetComponent <SphereCollider>(); alert = GetComponent <EnemyAlert>(); stats = GetComponent <EnemyStats>(); }