public override void OnCollision(GameObject other, Direction dir)
{
if (other is HitBox && invulnTime <= 0)
{
HitBox h = (HitBox)other;
if (h.parent != this)
{
Audio.GetInstance().Play(h.GetNoise());
this.Health -= h.GetDamage();
invulnTime = 700;
recoilAnim.Reset();
gettingPunched = true;
}
}
if (other is Fighter)
{
switch(dir)
{
case Direction.N:
Vel = new Vector2(Vel.X, Math.Max(Vel.Y,0));
// ResetPosY();
break;
case Direction.E:
Vel = new Vector2(Math.Max(Vel.X, 0), Vel.Y);
//ResetPosX();
break;
case Direction.S:
Vel = new Vector2(Vel.X, Math.Min(Vel.Y, 0));
// ResetPosY();
break;
case Direction.W:
Vel = new Vector2(Math.Min(Vel.X, 0), Vel.Y);
//ResetPosX();
break;
}
}
}