void Awake() { //navMeshAgent = GetComponent<NavMeshAgent>(); sphereCollider = GetComponent<SphereCollider>(); lastPlayerSighting = GameManager.Instance.GetComponent<LastPlayerSightingScript>(); player = GameObject.FindGameObjectWithTag(Tags.player); // Set the personal sighting and the previous sighting to the reset position. personalLastSighting = lastPlayerSighting.resetPosition; previousSighting = lastPlayerSighting.resetPosition; }
void Awake () { time = Time.time; //Getting the references agent = GetComponent<NavMeshAgent>(); enemySight = GetComponent<EnemySightScript>(); lastPlayerSighting = GameManager.Instance.GetComponent<LastPlayerSightingScript>(); if (target == null) target = GameObject.FindWithTag(Tags.player).transform; InvokeRepeating("StateLogic", 0, 0.01f); StartCoroutine("StateMachine"); }