Пример #1
0
        public ByteVector2[] GetPath(ByteVector2 from, ByteVector2 to)
        {
            // Update map
            Pathfinder.SetByteMap(Map);

            if (Map[to.X, to.Y] == Tile.Empty || Map[to.X, to.Y] == Tile.Gas) // EZ case
            {
                return(Pathfinder.FindBestPath(from, to));
            }
            else // The block is solid
            {
                return(Pathfinder.FindBestAdjacentPath(from, to));
            }
        }
Пример #2
0
        public ServerMapManager(byte mapSize, ServerGameManager context)
        {
            Debug.Log("Map Manager: Initializing map manager");
            MapGenerator gen = new MapGenerator(mapSize);

            Map = gen.GetMap();

            Pathfinder = new ServerPathfinder();
            Pathfinder.SetByteMap(Map);
            TileTriggerGrid    = new TriggerGrid(mapSize);
            TileOccupationGrid = new OccupationGrid(mapSize);
            TileGasManager     = new GasManager(this);
            GameManager        = context;
            //DebugPrintMap();
        }