示例#1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Enemy")
     {
         FindObjectOfType <AudioManager>().Play("Hit");
         hbc.Damage(-HealPerLevel * (gm.levels[2] + 1));
         if (collision.gameObject.GetComponent <BossHp>() != null)
         {
             if (Random.Range(0, 100) < gm.CRIT)
             {
                 collision.gameObject.GetComponent <BossHp>().Damage(Mathf.RoundToInt((Random.Range(5, 13) + 5 + DmgPerLevel * gm.levels[0]) * dmgMultiplier * 1.5f), 1);
             }
             else
             {
                 collision.gameObject.GetComponent <BossHp>().Damage(Mathf.RoundToInt((Random.Range(5, 13) + 5 + DmgPerLevel * gm.levels[0]) * dmgMultiplier));
             }
         }
         else
         {
             if (Random.Range(0, 100) < gm.CRIT)
             {
                 collision.gameObject.GetComponent <MonsterHp>().Damage(Mathf.RoundToInt((Random.Range(5, 13) + 5 + DmgPerLevel * gm.levels[0]) * dmgMultiplier * 1.5f), 1);
             }
             else
             {
                 collision.gameObject.GetComponent <MonsterHp>().Damage(Mathf.RoundToInt((Random.Range(5, 13) + 5 + DmgPerLevel * gm.levels[0]) * dmgMultiplier));
             }
         }
     }
 }
示例#2
0
 IEnumerator heal()
 {
     while (true)
     {
         if (enter)
         {
             hbc.Damage(-HealPerLevel * (gm.levels[2] + 1));
         }
         yield return(new WaitForSecondsRealtime(0.2f));
     }
 }