示例#1
0
文件: Enemy.cs 项目: MgCohen/AutoShot
 public void TakeDamage(int amount, int Penetration = 0)
 {
     if (immune)
     {
         return;
     }
     if (amount <= 0)
     {
         return;
     }
     if (Penetration >= Endurance)
     {
         anim.SetTrigger("Hurt");
     }
     health -= amount;
     if (health <= 0)
     {
         if (Penetration < Endurance)
         {
             anim.SetTrigger("Hurt");
         }
         anim.SetBool("Dead", true);
         coll.enabled = false;
         rb.velocity  = Vector2.zero;
         GetComponent <PathMaker>().stopped = true;
         if (TargetSystem.currentTarget == gameObject)
         {
             TargetSystem.DumpTarget(true);
         }
         ClockSystem.ChangeScale(0.1f, 0.1f);
         Camera.main.DOShakePosition(0.25f, 0.75f);
         //SimpleCameraShakeInCinemachine.instance.SetShake(0.25f, 0.75f, 1f);
         Destroy(gameObject, 2f);
         dead = true;
     }
 }