Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     nav.SetDestination(player.position);
     if (!playerInRange)
     {
         calculateTimer += Time.deltaTime;
         if (calculateTimer >= 1.0f)
         {
             if (calculateDistance() <= 2)
             {
                 playerInRange = true;
             }
         }
     }
     else if (playerInRange && !canvasController.isGameOver)
     {
         hitTimer += Time.deltaTime;
         if (hitTimer >= 1.0)
         {
             playerValues.DecreaseHealth((int)damage);
             hitTimer = 0.0f;
         }
     }
 }