public void Execute() { audio.PlaySound("restart"); GameStateManager.GetInstance().Remove(); GameStateManager.GetInstance().Add(new DoodleJumpState(_graphics, graphicsManager)); }
private static void SideCollide(ItemObject item, AbsObject obj, bool[] directionsBlocked, AudioManager audio) { if (obj is BlockObject || obj is PlatformObject) { if (Collision.GetCollisionType(item, obj) == Collision.CollisionType.RSide) { if (!directionsBlocked[1]) { directionsBlocked[1] = true; item._velocity.X *= -1; } } else { if (!directionsBlocked[3]) { directionsBlocked[3] = true; item._velocity.X *= -1; } } Console.WriteLine("Post side collision x velocity: " + item.Velocity.X); } else if (obj is MiscObject) { if (((MiscObject)obj).Type == "pipe_head" || ((MiscObject)obj).Type == "pipe_section") { item._velocity.X *= -1; if (Collision.GetCollisionType(item, obj) == Collision.CollisionType.RSide) { directionsBlocked[1] = true; } else { directionsBlocked[3] = true; } } else { item.ObjectsToNotCollide.Add(obj); } } else if (obj is MarioObject) { if (item.State == "coin") { audio.PlaySound("coin"); } else if (item.State == "1up") { audio.PlaySound("oneUp"); } item.Hitbox = new BoundingBox(new Vector3(0), new Vector3(0)); item.deleteThis = true; item.isVisible = false; } else if (obj is DoodleObject) { if (item.State == "speed" || item.State == "jump") { audio.PlaySound("potion"); } item.Hitbox = new BoundingBox(new Vector3(0), new Vector3(0)); item.deleteThis = true; item.isVisible = false; } else { item.ObjectsToNotCollide.Add(obj); } }