コード例 #1
0
        public ServerFactionManager(int id, ServerMapManager mapManagerReference, ServerGameManager gameManagerReference, ConnectedClient fClient = null, bool neutral = true)
        {
            Debug.Log("Faction Manager: Initializing player faction...");
            // TODO: genericize context?
            FactionID     = id;
            GameManager   = gameManagerReference;
            MapManager    = mapManagerReference;
            FactionClient = fClient;
            Credits       = Constants.Global.START_CREDITS;

            FactionMap = new Tile[MapManager.Map.GetLength(0), MapManager.Map.GetLength(0)];
            for (int i = 0; i < FactionMap.GetLength(0); i++)
            {
                for (int j = 0; j < FactionMap.GetLength(0); j++)
                {
                    FactionMap[i, j] = Tile.Fog;
                }
            }

            _pathfinder = new ServerPathfinder();
            Territory   = new HashSet <ByteVector2>();
            _toReveal   = new HashSet <ByteVector2>();

            if (!neutral)
            {
                SendInit();
                CrashDown();
                SendMap();
            }

            _neutral = neutral;
        }
コード例 #2
0
            public GasManager(ServerMapManager MapManager)
            {
                _emitters   = new List <Entity>();
                _pathfinder = new ServerPathfinder();
                _mapManager = MapManager;
                _territory  = new HashSet <ByteVector2>();

                int length = MapManager.Map.GetLength(0);

                _gasMap  = new double[length, length];
                _fillMap = new double[length, length];
            }
コード例 #3
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();
        }