Beispiel #1
0
        public Unit(PlayerState owner, int id, UnitConfiguration configuration, Server server)
        {
            Owner = owner;
            Id = id;
            Faction = server.GetFaction(configuration.FactionId);
            Type = Faction.GetUnitType(configuration.UnitTypeId);
            Upgrades = new List<UnitUpgrade>();
            _Points = Type.Points;
            UpgradeSlotsOccupied = new HashSet<int>();
            foreach (var upgradeId in configuration.UpgradeIds)
                AddUpgrade(GetUpgrade(upgradeId));

            Hex = null;
            Strength = GameConstants.FullUnitStrength;

            Entrenched = false;

            AttritionDuration = 0;

            UpdateStats();
            ResetUnitForNewTurn();

            // Only air units are automatically "deployed" since they don't need to be placed on the map
            Deployed = Stats.Flags.Contains(UnitFlag.Air);
        }
Beispiel #2
0
        public ServerGame(Server server, ServerClient owner, bool isPrivate, string privateKey, GameConfiguration gameConfiguration, Map map)
            : base(gameConfiguration, map)
        {
            Server = server;

            Owner = owner;

            IsPrivate = isPrivate;
            PrivateKey = privateKey;

            UnitIdCounter = 0;
        }
Beispiel #3
0
        public ServerClient(Stream stream, Server server)
        {
            Stream = stream;
            Server = server;

            SendEvent = new ManualResetEvent(false);
            SendQueue = new List<ServerToClientMessage>();

            ShuttingDown = false;

            MessageHandlerMap = new Dictionary<ClientToServerMessageType, MessageHandler>();

            InitialiseMessageHandlerMap();

            _Name = null;

            _PlayerState = null;
            ConnectedState();
        }