Esempio n. 1
0
        private void Hit(Hit hit)
        {
            if (hit.hit < minDefense)
            {
                return;
            }
            //    y =\left(x - m\right)\left(1 - z\right)\left(1 - c\right)\left\{ x > 0\right\}
            float chp = (hit.hit - minDefense) * UnityEngine.Random.Range(0, 1) < coverage ? (1 - defense) : 1;

            hp -= chp;
            if (hp <= 0)
            {
                if (DeadCallBack == null)
                {
                    Destroy(gameObject);
                }
                else
                {
                    DeadCallBack(this, hit);
                }
                Messenger.Broadcast(EventCode.ENEMY_DEAD, gameObject.name);
            }
        }
Esempio n. 2
0
 public void Recipient(Hit hit)
 {
     Hit(hit);
 }