//!---METHODS---! public override bool Update(ContentManager Content) { //!--EXIT KEEP AT TOP--! if (CheckEscape()) { StateManager.CreateState("PopQuestion", new States.Menus.PopQuestion(Content, new Neuroleptic.Control.Questions.State("Main", "Go Back to Main Menu?"))); StateManager.PushState("PopQuestion"); } if (Game1.ePlayer != null) { Game1.ePlayer = null; } #if DESKTOP msMouse = Mouse.GetState(); #else ButtonState bsLeft = ButtonState.Released; var touch = TouchPanel.GetState().FirstOrDefault(); var pos = touch.Position; var state = touch.State; if (pos.X > 0 && pos.Y > 0){bsLeft = ButtonState.Pressed;} msMouse = new MouseState((int)pos.X,(int)pos.Y,0,bsLeft,ButtonState.Released,ButtonState.Released,ButtonState.Released,ButtonState.Released); #endif //!--UPDATE KEEP AT TOP--! eRoom.Update(Content, msMouse); v2MousePos = new Vector2(msMouse.X, msMouse.Y); //!--UPDATE KEEP AT TOP--! if (msMouse.RightButton == ButtonState.Pressed || GamePad.GetState(PlayerIndex.One).Buttons.RightShoulder == ButtonState.Pressed) { eRoom.CheckRemove(v2MousePos); } else if (msMouse.LeftButton == ButtonState.Pressed) { eRoom.CheckWorld(v2MousePos); } //!--DROP DOWNS--! CheckDropDowns(); //!--SAVING--! if (eRoom.Button("Save").IsClicked) { eRoom.Button("Save").IsClicked = false; Rooms.Room rmSave = new Rooms.Room(); //create a room to add rmSave.RoomBase = new AnimatedSprite(eRoom.RoomBase); if (eRoom.Player != null) { Game1.ePlayer = new Entities.Player(eRoom.Player); } foreach (Items.Item i in eRoom.Items) { if (i.GetType() == typeof(Items.Psyche)) { rmSave.AddItem(new Items.Psyche((Items.Psyche)i)); } else if (i.GetType() == typeof(Items.Weapon)) { rmSave.AddItem(new Items.Weapon((Items.Weapon)i)); } } foreach (Entities.Entity e in eRoom.Enemies) { if (e.GetType() == typeof(Entities.BasicEnemy)) { rmSave.AddEntity(new Entities.BasicEnemy((Entities.BasicEnemy)e)); } else if (e.GetType() == typeof(Entities.BossEnemy)) { rmSave.AddEntity(new Entities.BossEnemy((Entities.BossEnemy)e)); } else if (e.GetType() == typeof(Entities.SpawnerEnemy)) { rmSave.AddEntity(new Entities.SpawnerEnemy((Entities.SpawnerEnemy)e)); } else if (e.GetType() == typeof(Entities.Enemy)) { rmSave.AddEntity(new Entities.Enemy((Entities.Enemy)e)); } } foreach (Rooms.Obstacle o in eRoom.Objects) { rmSave.AddObject(new Rooms.Obstacle(o)); } //Add all obstacles StateManager.CreateState("PopQuestion", new States.Menus.PopQuestion(Content, new Neuroleptic.Control.Questions.Save(Content, rmSave))); StateManager.PushState("PopQuestion"); } //!--QUIT--! if (eRoom.Button("Quit").IsClicked) { eRoom.Button("Quit").IsClicked = false; StateManager.CreateState("PopQuestion", new States.Menus.PopQuestion(Content, new Neuroleptic.Control.Questions.State("Main", "Go Back to Main Menu?"))); StateManager.PushState("PopQuestion"); } //!--LOADING--! if (eRoom.Button("Load").IsClicked) { eRoom.Button("Load").IsClicked = false; States.StateManager.CreateState("EditorLoad", new Menus.EditorLoad(Content)); StateManager.CreateState("PopQuestion", new States.Menus.PopQuestion(Content, new Neuroleptic.Control.Questions.State("EditorLoad", "Are you sure you want to Load a new room?"))); StateManager.PushState("PopQuestion"); } if (eRoom.Button("Clear").IsClicked) { eRoom.Button("Clear").IsClicked = false; StateManager.CreateState("PopQuestion", new States.Menus.PopQuestion(Content, new Neuroleptic.Control.Questions.Function((eRoom.ClearWorld)))); StateManager.PushState("PopQuestion"); } //!--PLAY--! if (eRoom.Button("Test").IsClicked) { eRoom.Button("Test").IsClicked = false; if (eRoom.Player != null) { //Make sure we have a player. else why bother right?! Rooms.RoomManager.Clear(); //Clear any rooms we may have, this should be cleared anyway, but double checking wont hurt Rooms.Room rmPlay = new Rooms.Room(); //create a room to add Rooms.RoomManager.Add(rmPlay); //we can add it here, so lets //make all World stuffs using a new copy to keep the "editor" the same foreach (Items.Item i in eRoom.Items) { if (i.GetType() == typeof(Items.Psyche)) { rmPlay.AddItem(new Items.Psyche((Items.Psyche)i)); } else if (i.GetType() == typeof(Items.Weapon)) { rmPlay.AddItem(new Items.Weapon((Items.Weapon)i)); } } foreach (Entities.Entity e in eRoom.Enemies) { if (e.GetType() == typeof(Entities.BasicEnemy)) { rmPlay.AddEntity(new Entities.BasicEnemy((Entities.BasicEnemy)e)); } else if (e.GetType() == typeof(Entities.BossEnemy)) { rmPlay.AddEntity(new Entities.BossEnemy((Entities.BossEnemy)e)); } else if (e.GetType() == typeof(Entities.SpawnerEnemy)) { rmPlay.AddEntity(new Entities.SpawnerEnemy((Entities.SpawnerEnemy)e)); } else if (e.GetType() == typeof(Entities.Enemy)) { rmPlay.AddEntity(new Entities.Enemy((Entities.Enemy)e)); } } foreach (Rooms.Obstacle o in eRoom.Objects) { rmPlay.AddObject(new Rooms.Obstacle(o)); } //Add all obstacles Game1.ePlayer = new Entities.Player(eRoom.Player); Game1.ePlayer.HealthCurrent = Game1.ePlayer.HealthMax = 100000; States.StateManager.CreateState("LevelBasic", new Neuroleptic.States.LevelBasic(Content,false, eRoom.RoomBase)); //create the state States.StateManager.PushState("LevelBasic"); //push it ontop of this one, so we can come back by pressing ESC/BACK } } return true; }