public static void HandleCollision(IUsableItem item, IBlock block, Enumerations.CollisionSide collision) { Contract.Requires(block != null); Contract.Requires(item != null); block.IsDestructable = true; foreach (IDoorTrigger doorTrigger in Room.CurrentRoomDoorTriggers) { if (doorTrigger.GameObjectType == Enumerations.GameObjectType.DoorTriggerUp) { doorTrigger.IsDestructable = true; } } IBlock newDoor = new BlockUpBombedOpening(); newDoor.Position = block.Position; IDoorTrigger newTrigger = new BlockUpOverBombed(); newTrigger.Position = new Vector2(Constant.UpOverBombedPositionNative.X * Game1.Instance.graphics.PreferredBackBufferWidth / Constant.OriginalNesWidth, (Constant.UpOverBombedPositionNative.Y + HUDConstants.HUDHeight) * Game1.Instance.graphics.PreferredBackBufferHeight / Constant.OriginalNesHeight); Room.CurrentRoomBlocks.Add(newDoor); Room.CurrentRoomDoorTriggers.Add(newTrigger); SoundManager.Instance.PlayFoundSecret(); int oppositeRoom = GameObjects.Instance.LevelListPosition - Constant.DungeonGridWidth; Enumerations.Direction doorDirection = Enumerations.Direction.Down; Enumerations.DoorType doorType = Enumerations.DoorType.Bombed; ToolsXML toolsXml = new ToolsXML(); toolsXml.ReplaceOppositeDoorNodeXML(oppositeRoom, doorType, doorDirection); }
public static void HandleCollision(ILink link, IDoorTrigger doorTrigger, Enumerations.CollisionSide collision) { Contract.Requires(link != null); Contract.Requires(doorTrigger != null); GameObjects.Instance.currentRoom.UpdateSavedStateXML(); ToolsXML toolsXml = new ToolsXML(); toolsXml.SaveUpdatedRoomXml(); roomTransition.Update(doorTrigger); toolsXml.SetStageXmlDocument(); }
public void UpdateChar(List <INPC> currentRoomChars) { if (currentRoomChars.Count != 0) { for (int characterCount = 0; characterCount < currentRoomChars.Count; characterCount++) { currentRoomChars[characterCount].Update(); if (currentRoomChars[characterCount].IsDestructable) { currentRoomChars.Remove(currentRoomChars[characterCount]); } } } else { ToolsXML toolsXML = new ToolsXML(); toolsXML.OpenAllSealedDoors(Room.CurrentRoomBlocks); } }
public StateClassicGame() { Game = Game1.Instance; Game.State = this; SoundManager.Instance.PlayDefaultMusic(); ToolsXML toolsXml = new ToolsXML(); toolsXml.InitializeGameObjects(); GameObjects.Instance.loadObjs(); toolsXml.SetStageXmlDocument(); Game.Link = new Link(); Game.miniHUD = new MiniHUD(Game.Link); Game.PauseHUD = new PauseHUD(Game.Link, Game.miniHUD); Game.miniHUD.LoadHUDTextures(); Game.PauseHUD.LoadHUDTextures(); Game.CollisionDetector = new CollisionDetector(); }
public static void HandleCollision(ILink link, IBlock block, Enumerations.CollisionSide collision) { Contract.Requires(link != null); Contract.Requires(block != null); if (InventoryAgrees(link)) { block.IsDestructable = true; foreach (IDoorTrigger doorTrigger in Room.CurrentRoomDoorTriggers) { if (doorTrigger.GameObjectType == Enumerations.GameObjectType.DoorTriggerLeft) { doorTrigger.IsDestructable = true; } } foreach (IBlock blockDoor in Room.CurrentRoomBlocks) { if (block.GameObjectType == Enumerations.GameObjectType.DoorLeft) { blockDoor.IsDestructable = true; } } IBlock newDoor = new BlockLeftOpenDoor(); newDoor.Position = new Vector2(Constant.LeftDoorPositionNative.X * Game1.Instance.graphics.PreferredBackBufferWidth / Constant.OriginalNesWidth, (Constant.LeftDoorPositionNative.Y + HUDConstants.HUDHeight) * Game1.Instance.graphics.PreferredBackBufferHeight / Constant.OriginalNesHeight); IDoorTrigger newTrigger = new BlockLeftOverDoor(); newTrigger.Position = new Vector2(Constant.LeftOverDoorPositionNative.X * Game1.Instance.graphics.PreferredBackBufferWidth / Constant.OriginalNesWidth, (Constant.LeftOverDoorPositionNative.Y + HUDConstants.HUDHeight) * Game1.Instance.graphics.PreferredBackBufferHeight / Constant.OriginalNesHeight); Room.CurrentRoomBlocks.Add(newDoor); Room.CurrentRoomDoorTriggers.Add(newTrigger); SoundManager.Instance.PlayDoorStateChange(); int oppositeRoom = GameObjects.Instance.LevelListPosition - 1; Enumerations.Direction doorDirection = Enumerations.Direction.Right; Enumerations.DoorType doorType = Enumerations.DoorType.Locked; ToolsXML toolsXml = new ToolsXML(); toolsXml.ReplaceOppositeDoorNodeXML(oppositeRoom, doorType, doorDirection); } }