public override void Update(GameTime gt) { base.Update(gt); if (Helpers.InputHelper.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.Space)) { _SM.ActivateScene("Mega"); return; } Tile hoveredTile = _MapManager.findTile(InputHelper.MouseScreenPos); if (InputHelper.IsKeyPressed(Keys.D1)) { TileOne = hoveredTile; if (TileOne != null && TileTwo != null) { _MapManager.ResetTileColors(); path = _MapManager.AStarTwo(TileOne, TileTwo, diagonalPaths); } } if (InputHelper.IsKeyPressed(Keys.D2)) { TileTwo = hoveredTile; if (TileOne != null && TileTwo != null) { _MapManager.ResetTileColors(); path = _MapManager.AStarTwo(TileOne, TileTwo, diagonalPaths); } } if (InputHelper.IsKeyPressed(Keys.T)) { diagonalPaths = !diagonalPaths; if (TileOne != null && TileTwo != null) { _MapManager.ResetTileColors(); path = _MapManager.AStarTwo(TileOne, TileTwo, diagonalPaths); } } if (InputHelper.IsKeyPressed(Keys.O)) { TileOne = null; TileTwo = null; path = null; } }
public void CreateNPC(TmxObject thing, Vector2 pos) { if (thing.Type.Equals("Slime")) { Slime newSprite = new GameObjects.NPCs.Monsters.Slime(this); newSprite._Position = _TilemapManager.findTile(pos).tileCenter; newSprite.LoadContent("Art/" + thing.Type, _Content); newSprite.SetBoundaries(thing.X, thing.Width, thing.Height, thing.Y); if (Convert.ToBoolean(thing.Properties["Agressive"])) { newSprite.AddTarget(thePlayer); } newSprite._Tag = Sprite.SpriteType.kMonsterType; newSprite.Name = thing.Name.ToUpper(); newSprite._CurrentState = Sprite.SpriteState.kStateActive; newSprite.parentList = _SpriteListActive; _SpriteListActive.Add(newSprite); } else if (thing.Type.Equals("Banker")) { GameObjects.NPCs.Banker newSprite = new GameObjects.NPCs.Banker(this); newSprite._Position = _TilemapManager.findTile(pos).tileCenter; newSprite.LoadContent("Art/" + thing.Type, _Content); newSprite.SetBoundaries(thing.X, thing.Width, thing.Height, thing.Y); //if (Convert.ToBoolean(thing.Properties["Agressive"])) //{ // //newSprite.AddTarget(thePlayer); //} newSprite._Tag = Sprite.SpriteType.kNPCType; newSprite.Name = thing.Name.ToUpper(); newSprite._CurrentState = Sprite.SpriteState.kStateActive; newSprite.parentList = _SpriteListActive; _SpriteListActive.Add(newSprite); } else if (thing.Type.Equals("DairyCow")) { GameObjects.NPCs.DairyCow newSprite = new GameObjects.NPCs.DairyCow(this); newSprite._Position = _TilemapManager.findTile(pos).tileCenter; newSprite.LoadContent("Art/" + thing.Type, _Content); newSprite.SetBoundaries(thing.X, thing.Width, thing.Height, thing.Y); //if (Convert.ToBoolean(thing.Properties["Agressive"])) //{ // //newSprite.AddTarget(thePlayer); //} newSprite._Tag = Sprite.SpriteType.kNPCType; newSprite.Name = thing.Name.ToUpper(); newSprite._CurrentState = Sprite.SpriteState.kStateActive; newSprite.parentList = _SpriteListActive; _SpriteListActive.Add(newSprite); } else if (thing.Type.Equals("QuestSlime")) { GameObjects.NPCs.QuestSlime newSprite = new GameObjects.NPCs.QuestSlime(this); newSprite._Position = _TilemapManager.findTile(pos).tileCenter; newSprite.LoadContent("Art/" + thing.Type, _Content); newSprite.SetBoundaries(thing.X, thing.Width, thing.Height, thing.Y); //if (Convert.ToBoolean(thing.Properties["Agressive"])) //{ // //newSprite.AddTarget(thePlayer); //} newSprite._Tag = Sprite.SpriteType.kNPCType; newSprite.Name = thing.Name.ToUpper(); newSprite._CurrentState = Sprite.SpriteState.kStateActive; newSprite.parentList = _SpriteListActive; _SpriteListActive.Add(newSprite); } }