public bool Damage(int amount, DirectionHorizontal dir) { if (IsInvincible()) { return(false); //Do nothing on invincible } health.Decrease(amount); MakeInvincible(cdbInv); //Make player invincible Stun(cdbStun, dir); //Stun player mgJump.ForceJump(cdbStunJump); //Stun jump mgLevel.RemovePlayerHealth(amount); mgAttack.DisruptAttack(); return(true); }
void OnHitEnemy(GameObject enemy) { enemy.GetComponent <Health>().Decrease(damage); if (attackDir == Direction.DOWN) { mgJump.ForceJump(0.25f); //Pogo player.ResetDash(); } else if (attackDir == Direction.RIGHT) { mgMovement.ForceMove(DirectionHorizontal.LEFT, 0.2f); } else if (attackDir == Direction.LEFT) { mgMovement.ForceMove(DirectionHorizontal.RIGHT, 0.2f); } }