//Give him some damages if he is in zone
 public void ApplyDamages()
 {
     if (IsInZone && canGiveDmg && bossJambesScript.IsWalking)
     {
         canGiveDmg = false;
         StartCoroutine("DmgDamp");
         lifeSystemScript.LowerLife();
     }
 }
Example #2
0
 void ApplyKickDamages()
 {
     if (sideLeft)
     {
         if (leftDamageZoneScript.IsInZone)
         {
             lifeSystemScript.LowerLife();
             playerRigidbody.AddForce(Vector2.up * kickForce, ForceMode2D.Impulse);
         }
     }
     else
     {
         if (rightDamageZoneScript.IsInZone)
         {
             lifeSystemScript.LowerLife();
             playerRigidbody.AddForce(Vector2.up * kickForce, ForceMode2D.Impulse);
         }
     }
 }
Example #3
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            //If the Player isn't dashing and isn't colliding with the head collider...
            if (!playerDashing && !enemyHeadColliderScript.HeadBump)
            {
                if (!playerInhaling)
                {
                    //...and he is not using the Inhale power, lower is life
                    playerLifeSystem.LowerLife();
                }
                else
                {
                    //...and he is using the Inhale power, rise is life
                    playerLifeSystem.RiseLife();
                }
            }

            //Kill the enemy.
            Kill();
        }
    }