Ejemplo n.º 1
0
 private void Awake()
 {
     mapParser = new MapParser();
     foreach (var image in imageMaps)
     {
         maps.Add(mapParser.ParseMap(image));
     }
 }
Ejemplo n.º 2
0
        public void testShortestPathEmpty()
        {
            IBoard            b    = parser.ParseMap(new List <string>(new string[] { " " })).Board;
            Square            s1   = b.SquareAt(0, 0);
            Square            s2   = b.SquareAt(0, 0);
            IList <Direction> path = Navigation
                                     .shortestPath(s1, s2, new Mock <Unit>().Object);

            Assert.AreEqual(0, path.Count);
        }
Ejemplo n.º 3
0
        public List <Structure> Generate(MapContext context)
        {
            List <IExpression> expressions = _parser.ParseMap($"{_projectDirectory}/assets/maps/testMap.txt");

            context.Reset();
            expressions.ForEach(exp => exp.Eval(context));

            return(context.Structures);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.SetBufferSize(80, 500);
            MapParser.ParseMap(@"E:\Documents\parsertest.map");

            /*Vec3 point = new Vec3(0, 0, 0);
             * Plane a = new Plane(new Vec3(1, 0, 0), -1);
             *
             * Console.WriteLine(PlaneUtil.ClassifyPoint(a, point).ToString());*/

            Console.ReadLine();
        }
Ejemplo n.º 5
0
    public bool Initialize(string filename, Options opts)
    {
        bool      result = false;
        MapParser parser = new MapParser();

        options     = opts;
        MapSections = parser.ParseMap(filename);

        if (FetchMapDimension())
        {
            InitializeXY();
            result = true;
        }
        return(result);
    }
Ejemplo n.º 6
0
        public static GameObject LoadMap(string path, string pathToTextures, Shader diffuse = null, Shader transparent = null,
                                         bool generateCollisionMesh = true)
        {
            if (Mathf.Approximately(MapScaleFactor, 0))
            {
                Debug.LogError("MapScaleFactor cannot be 0!");
                return(null);
            }

            _materialCache.Clear();
            _wadsUsed.Clear();

            _pathToMapTextures     = pathToTextures;
            _diffuseShader         = diffuse;
            _transparentShader     = transparent;
            _generateCollisionMesh = generateCollisionMesh;

            MapFile map = MapParser.ParseMap(path);

            return(BuildMapMesh(map));
        }
Ejemplo n.º 7
0
        public Level MakeLevel()
        {
            Stream    boardStream = null;
            MapParser parser      = GetMapParser();

            try
            {
                System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
                boardStream = myAssembly.GetManifestResourceStream("CsPacman.board.txt");
                return(parser.ParseMap(boardStream));
            }
            catch (IOException e)
            {
                throw new PacmanConfigurationException("Unable to create level.", e);
            }
            finally
            {
                if (boardStream != null)
                {
                    boardStream.Dispose();
                }
            }
        }
Ejemplo n.º 8
0
        private static void Main()
        {
            ConsoleSettings.PrepareConsole();
            KeyboardInterface keyboard = new KeyboardInterface();

            Opponent enemy = new Opponent(new MatrixCoords(3, 3), new char[, ] {
                { '@' }
            }, null);

            ConsoleRenderer renderer = new ConsoleRenderer(ConsoleSettings.ConsoleHeight, ConsoleSettings.ConsoleWidth);

            IList <WorldObject> map = MapParser.ParseMap("../../WorldMaps/map.txt");

            GameEngine.GameEngine gameEngine = new GameEngine.GameEngine(renderer, keyboard);

            int heroChosen = 0;

            Console.WriteLine("Please select your Hero: \nPress 1 for  Mage\nPress 2 for  Thief\nPress 3 for  Warrior");

            // validates hero choice and let's player choose correctly
            do
            {
                try
                {
                    heroChosen = int.Parse(Console.ReadLine());
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine("Please choose 1, 2 or 3");
                }
            } while (!true || heroChosen < 1 || heroChosen > 3);

            Console.Clear();

            // TODO implement interface for the choice of type of character
            MainCharacter hero = HeroChoice(heroChosen);

            hero.AddWeapon(new Knife("Steel knife")
            {
                MinDmg = 20, MaxDmg = 30
            });
            //hero.AddWeapon(new Knife("mnogo qk knife") { MaxDmg = 30, MinDmg = 20 });
            gameEngine.AddObject(hero);
            gameEngine.AddObject(enemy);
            Opponent newOpponent = new Opponent(new MatrixCoords(2, 35), new char[, ] {
                { '@' }
            }, new BattleAxe("Battle Axe"));
            Opponent newOpponent2 = new Opponent(new MatrixCoords(7, 30), new char[, ] {
                { '@' }
            }, new Knife("Steel knife"));
            Opponent newOpponent3 = new Opponent(new MatrixCoords(10, 10), new char[, ] {
                { '@' }
            }, new BattleAxe("Battle Axe"));
            Opponent newOpponent4 = new Opponent(new MatrixCoords(15, 15), new char[, ] {
                { '@' }
            }, new BattleAxe("Battle Axe"));

            gameEngine.AddObject(newOpponent);
            gameEngine.AddObject(newOpponent2);
            gameEngine.AddObject(newOpponent3);
            gameEngine.AddObject(newOpponent4);
            foreach (var item in map)
            {
                gameEngine.AddObject(item);
            }

            keyboard.OnDownPressed   += (sender, eventInfo) => { hero.Move(Direction.Down); };
            keyboard.OnLeftPressed   += (sender, eventInfo) => { hero.Move(Direction.Left); };
            keyboard.OnRightPressed  += (sender, eventInfo) => { hero.Move(Direction.Right); };
            keyboard.OnUpPressed     += (sender, eventInfo) => { hero.Move(Direction.Top); };
            keyboard.onPotionPressed += (sencer, eventInfo) => { hero.Health += 5; };

            gameEngine.Run();
        }
Ejemplo n.º 9
0
 private void TakeTurn()
 {
     ServerCommunications.SendTurnData(PlayerAction);
     PlayerAction = null;
     MainMap      = MapParser.ParseMap(ServerCommunications.ReceiveGameState());
 }
    private void CreateMap(TextAsset map)
    {
        m_MapData = m_MapParser.ParseMap(map.text);

        m_MapBuilder.BuildMap(m_MapData);
    }