Exemplo n.º 1
0
 private void GetAttack(int hp)
 {
     if (EnemyState == AnimationStates.Death)
     {
         return;
     }
     emenyState = AnimationStates.Attack;
     transform.LookAt(player);
     if (UnityEngine.Random.Range(1, 11) / (double)10 <= enemyInfo.MissPrecent)
     {
         enemyShow.ShowAttackMsg("Miss", Color.green);
     }
     else
     {
         PlayAnim("TakeDamage1");
         enemyInfo.Hp -= hp;
         enemyShow.ShowAttackMsg(" - " + hp, Color.red);
     }
     if (enemyInfo.Hp <= 0)
     {
         PlayAnim("Death");
         EnemyState = AnimationStates.Death;
         PlayerStatusManager.Instance.AddExp(enemyInfo.Exp);
         GameObject go = GameObject.Instantiate(Death_Pre, transform.position, transform.rotation);
         go.GetComponent <EnemyDeath>().Death(enemyInfo.EnemyType);
         Destroy(this.gameObject);
     }
 }
Exemplo n.º 2
0
 public void GetAttack(int hp)
 {
     if (playerState == AnimationStates.Death)
     {
         return;
     }
     playerState = AnimationStates.Attack;
     if (UnityEngine.Random.Range(1, 11) / (double)10 <= PlayerStatusManager.Instance.playerInfo.MissPrecent)
     {
         AttackShow.ShowAttackMsg("Miss", Color.green);
     }
     else
     {
         PlayAnim("TakeDamage1");
         AttackShow.ShowAttackMsg(" - " + hp, Color.red);
         bool death = PlayerStatusManager.Instance.TakeDamage(hp);
         if (!death)
         {
             PlayAnim("Death");
             playerState = AnimationStates.Death;
         }
     }
 }