Beispiel #1
0
 void Update()
 {
     target = targetTransform.transform.position;
     if (Vector3.Distance(target, transform.position) < 1f)
     {
         int chance;
         chance = Random.Range(1, 100);
         if (chance < playerFunction.lightChance)
         {
             enemyFunction.TakeLightDamageRanged();
         }
         else
         {
             enemyFunction.Miss();
         }
         playerFunction.CallReset();
         Destroy(this.gameObject);
     }
     transform.Translate(Vector2.right * speed * Time.deltaTime);
 }