Ejemplo n.º 1
0
 public void LightDamage()
 {
     if (stamina < LightCost)
     {
         Sleep();
     }
     else
     {
         DemoEndStats.lightCounter++;
         stamina = stamina - LightCost;
         buttons.SetActive(false);
         anim.SetInteger("State", 2);
         if (Vector3.Distance(target, transform.position) < 2.5f)
         {
             int chance;
             chance = Random.Range(1, 100);
             if (chance < lightChance)
             {
                 enemyFunction.TakeLightDamage();
             }
             else
             {
                 enemyFunction.Block();
             }
         }
         else
         {
             enemyFunction.Miss();
         }
         StartCoroutine(Resetturn());
     }
 }
Ejemplo n.º 2
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);
 }