Example #1
0
    public void TakeDamage(int damage)
    {
        hp -= damage;

        animator.SetTrigger("Damaged");

        hpController.UpdateHP(hp);

        if (hp <= 0 && !isDead)
        {
            DeathAnimation();
            Invoke("Resurrect", 3);
        }
    }
Example #2
0
 void Start()
 {
     // Store reference to attached component
     controller = GetComponent <Rigidbody2D>();
     HPC        = GameObject.Find("HPC").GetComponent <HPController>();
     seedSystem = GameObject.Find("SeedSystem").GetComponent <SeedSystem>();
     hp         = maxhp = seedSystem.maxhp();
     HPC.UpdateHP(hp, maxhp);
     lastHunger = Time.time * 1000;
     if (seedSystem.getAttackBuff())
     {
         weapon.Buff();
     }
 }
Example #3
0
 public void ReceiveDamage(int atk, Vector2 knockback)
 {
     forceToBeAdded = knockback;
     HPC.UpdateHP(hp, maxhp);
     hp -= atk;
 }