示例#1
0
        public ServerWorldSimluater(int levelId, int index, List <BattlePlayer> battlePlayers)
        {
            LevelID     = levelId;
            Index       = index;
            IsCompleted = false;
            LevelData   = ExcelToJSONConfigManager.Current.GetConfigByID <BattleLevelData>(levelId);
            MapConfig   = ExcelToJSONConfigManager.Current.GetConfigByID <MapData>(LevelData.MapID);
            var mapGridName = MapConfig.LevelName + ".bin";
            var data        = ResourcesLoader.Singleton.GetMapGridByLevel(mapGridName);

            Grid         = new Astar.GridBase();
            Grid.maxX    = data.MaxX;
            Grid.maxY    = data.MaxY;
            Grid.maxZ    = data.MaxZ;
            Grid.offsetX = data.Offset.x;
            Grid.offsetY = data.Offset.y;
            Grid.offsetZ = data.Offset.z;
            Grid.sizeX   = data.Size.x;
            Grid.sizeY   = data.Size.y;
            Grid.sizeZ   = data.Size.z;
            Grid.grid    = new Node[Grid.maxX, Grid.maxY, Grid.maxZ];
            Data         = data;
            foreach (var i in data.Nodes)
            {
                Grid.grid[i.X, i.Y, i.Z] = new Astar.Node()
                {
                    x          = i.X,
                    isWalkable = i.IsWalkable,
                    y          = i.Y,
                    z          = i.Z
                };
            }

            BattlePlayers = new SyncDictionary <long, BattlePlayer>();
            foreach (var i in battlePlayers)
            {
                BattlePlayers.Add(i.User.UserID, i);
            }
            //this.Runner = new Thread(RunProcess);
        }
示例#2
0
 //Constructor
 public Pathfinder(GridBase grid)
 {
     gridBase = grid;
 }