Ejemplo n.º 1
0
 private void Update()
 {
     //laser collided with source
     if (frame < 0)
     {
         Debug.Log(source.name + " was killed by own laser.");
         source.ClearActions();
         source.Kill();
         frame = 0;
         gameObject.SetActive(false);
         return;
     }
     //laser collided with target
     if (Vector3.Dot(destination - transform.position, direction) <= 0)
     {
         Debug.Log(source.name + "'s laser damaged " + target.name + " for " + DAMAGE_AMOUNT + " points of damage.");
         target.Damage(DAMAGE_AMOUNT);
         frame = 0;
         gameObject.SetActive(false);
     }
     else
     {
         //move laser
         frame += mult;
         transform.position += mult * direction;
     }
 }