private static void TopCollide(AbsAvatarObject avatar, AbsObject obj, bool[] directionsBlocked) { if (obj is BlockObject || obj is PlatformObject) { avatar._velocity.Y = 0; avatar.Displace(0, 0.5f); directionsBlocked[0] = true; } else if (obj is EnemyObject) { avatar.TakeDamage(); avatar.ObjectsToNotCollide.Add(obj); } else if (obj is ItemObject) { switch (((ItemObject)obj).State) { case "super": avatar.Super(); avatar.hud.ChangeScore(1000); break; case "fire": avatar.Fire(); avatar.hud.ChangeScore(1000); break; case "coin": avatar.hud.GetCoin(); break; case "star": avatar.hud.ChangeScore(1000); break; case "1up": avatar.hud.ChangeLife(1); break; default: break; } } else { avatar.ObjectsToNotCollide.Add(obj); } }
private static void BottomCollide(AbsAvatarObject avatar, AbsObject obj, bool[] directionsBlocked) { if (obj is BlockObject || obj is PlatformObject) { avatar._velocity.Y = 0; directionsBlocked[2] = true; avatar.isGrounded = true; if (avatar.movementState is LeftJumpingIdleState || avatar.movementState is LeftJumpingState) { avatar.movementState = new LeftIdleState(avatar); } else if (avatar.movementState is RightJumpingIdleState || avatar.movementState is RightJumpingState) { avatar.movementState = new RightIdleState(avatar); } } else if (obj is EnemyObject) { avatar._velocity.Y = -2; avatar.hud.ChangeScore(100); } else if (obj is ItemObject) { switch (((ItemObject)obj).State) { case "super": avatar.Super(); avatar.hud.ChangeScore(1000); break; case "fire": avatar.Fire(); avatar.hud.ChangeScore(1000); break; case "coin": avatar.hud.GetCoin(); break; case "star": avatar.hud.ChangeScore(1000); break; case "1up": avatar.hud.ChangeLife(1); break; default: break; } } else if (obj is MiscObject) { if (((MiscObject)obj).Type == "pipe_head") { avatar._velocity.Y = 0; avatar.PipeContacted = (MiscObject)obj; directionsBlocked[2] = true; avatar.isGrounded = true; if (avatar.movementState is LeftJumpingIdleState || avatar.movementState is LeftJumpingState) { avatar.movementState = new LeftIdleState(avatar); } else if (avatar.movementState is RightJumpingIdleState || avatar.movementState is RightJumpingState) { avatar.movementState = new RightIdleState(avatar); } } else { avatar.ObjectsToNotCollide.Add(obj); } } else { avatar.ObjectsToNotCollide.Add(obj); } }
private static void SideCollide(AbsAvatarObject avatar, AbsObject obj, bool[] directionsBlocked) { if (obj is BlockObject || obj is PlatformObject) { avatar._velocity.X = 0; if (Collision.GetCollisionType(avatar, obj) == Collision.CollisionType.RSide) { directionsBlocked[1] = true; } else { directionsBlocked[3] = true; } if (avatar.movementState is LeftWalkingState) { avatar.movementState = new LeftIdleState(avatar); } else if (avatar.movementState is RightWalkingState) { avatar.movementState = new RightIdleState(avatar); } else if (avatar.movementState is LeftJumpingState) { avatar.movementState = new LeftJumpingIdleState(avatar); } else if (avatar.movementState is RightJumpingState) { avatar.movementState = new RightJumpingIdleState(avatar); } } else if (obj is EnemyObject) { avatar.TakeDamage(); avatar.ObjectsToNotCollide.Add(obj); } else if (obj is ItemObject) { switch (((ItemObject)obj).State) { case "super": avatar.Super(); avatar.hud.ChangeScore(1000); break; case "fire": avatar.Fire(); avatar.hud.ChangeScore(1000); break; case "coin": avatar.hud.GetCoin(); break; case "star": avatar.hud.ChangeScore(1000); break; case "1up": avatar.hud.ChangeLife(1); break; default: break; } } else if (obj is MiscObject) { if (((MiscObject)obj).Type == "pipe_head" || ((MiscObject)obj).Type == "pipe_section") { avatar._velocity.X = 0; if (Collision.GetCollisionType(avatar, obj) == Collision.CollisionType.RSide) { directionsBlocked[1] = true; } else { directionsBlocked[3] = true; } if (avatar.movementState is LeftWalkingState) { avatar.movementState = new LeftIdleState(avatar); } else if (avatar.movementState is RightWalkingState) { avatar.movementState = new RightIdleState(avatar); } else if (avatar.movementState is LeftJumpingState) { avatar.movementState = new LeftJumpingIdleState(avatar); } else if (avatar.movementState is RightJumpingState) { avatar.movementState = new RightJumpingIdleState(avatar); } } else { avatar.ObjectsToNotCollide.Add(obj); } } else { avatar.ObjectsToNotCollide.Add(obj); } }
public void Execute() { recievier.Super(); }