Example #1
0
 // Update is called once per frame
 void Update()
 {
     if (agent.CompareTag("EasyMonster"))
     {
         target = GameObject.FindGameObjectWithTag("Player");
         // Sucht das target GameObject und bewegt sich zu ihm
         Vector3 vectorToTarget = target.transform.position;
         agent.SetDestination(vectorToTarget);
     }
     else if (agent.CompareTag("MiddleMonster"))
     {
         //The are moving to a random position(its update every time)
         if (!isInCorouting)
         {
             StartCoroutine(ManageDelaytimeToGetANewPosition());
         }
     }
     else if (agent.CompareTag("StrongMonster"))
     {
         Debug.Log("Monster most follow player's position, when reach the center!");
         target = GameObject.FindGameObjectWithTag("Player");
         Vector3 vectorToTarget = target.transform.position;
         agent.SetDestination(vectorToTarget);
     }
 }