Exemplo n.º 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;
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
        public ServerGameManager gameManager;   // The instance of the game

        public Context(int ownerID, int factionID, ServerGameManager context)
        {
            this.ownerID     = ownerID;
            this.factionID   = factionID;
            this.gameManager = context;
        }