private void Awake() { if (!instance) { instance = this; } else { Destroy(this); } spawnTimer = spawnTimerBase; }
// Use this for initialization void Start() { playerGO = GameObject.FindGameObjectWithTag("Player"); playerScript = playerGO.GetComponent <CharacterControl>(); GM = GameObject.FindGameObjectWithTag("GM"); gameOverScript = GM.GetComponent <gameOverText>(); spawnEnemiesScript = GM.GetComponent <spawnEnemies>(); agent = GetComponent <NavMeshAgent>(); startRotation = transform.rotation; anim = GetComponent <Animator>(); startPos = transform.position; endPos = startPos + (transform.forward * patrolDistance); }