// Use this for initialization void Start() { target = GameObject.FindWithTag("Player").transform; myTransform = gameObject.transform; if (originalPosition == new Vector3(0, 0, 0)) { Debug.Log("Should set an original position!"); originalPosition = myTransform.position; } alarmScript = GameObject.FindWithTag("Alarm").GetComponent<GameSettings>(); string difficulty = alarmScript.getDifficulty(); if (difficulty == "Easy") { fieldOfView *= 0.75f; } else if (difficulty == "Medium") { rangeOfView *= 1.25f; moveSpeed *= 2.0f; } else if (difficulty == "Hard") { fieldOfView *= 1.1f; rangeOfView *= 1.5f; moveSpeed *= 4.0f; } else Debug.Log("EnemyAI: Difficulty could not be found : " + difficulty); inCollider = new List<GameObject>(); agent = GetComponent<NavMeshAgent> (); if (originalPosition == targetPosition || targetPosition == new Vector3(0, 0, 0)) patrol = false; else { patrol = true; agent.SetDestination (targetPosition); agent.speed = moveSpeed/4; } }