Example #1
0
        public void MoveBy(Point positionChange)
        {
            Npc      monster  = GameLoop.World.CurrentMap.GetEntityAt <Npc>(Position + positionChange);
            BodyPart bodyPart = GameLoop.World.CurrentMap.GetEntityAt <BodyPart>(Position + positionChange);
            TileDoor door     = GameLoop.World.CurrentMap.GetTileAt <TileDoor>(Position + positionChange);

            if (monster != null)
            {
                Combat.BumpAttack(this, monster);
            }
            else if (bodyPart != null)
            {
                Mouth.Mastication(bodyPart);
            }
            else if (door != null && !door.IsOpen)
            {
                UseDoor(door);
            }
            else if (GameLoop.World.CurrentMap.IsTileWalkable(Position + positionChange))
            {
                Position += positionChange;
                GameLoop.UIManager.MapConsole.CenterViewPortOnPoint(GameLoop.World.Player.Position);
            }
            else
            {
                return;
            }

            GameLoop.GSManager.turnTaken = true;
        }