Ejemplo n.º 1
0
 public ApiJoinGameInfo(long maxTicks, ApiPlayerRole playerRole, ApiShipConstraints shipConstraints, ApiPlanet planet, ApiShipMatter defenderShip)
 {
     MaxTicks        = maxTicks;
     PlayerRole      = playerRole;
     ShipConstraints = shipConstraints;
     Planet          = planet;
     DefenderShip    = defenderShip;
 }
Ejemplo n.º 2
0
 public ApiShip(ApiPlayerRole role, long shipId, V position, V velocity, ApiShipMatter matter, long temperature, long criticalTemperature, long maxFuelBurnSpeed)
 {
     Role                = role;
     ShipId              = shipId;
     Position            = position;
     Velocity            = velocity;
     Matter              = matter;
     Temperature         = temperature;
     CriticalTemperature = criticalTemperature;
     MaxFuelBurnSpeed    = maxFuelBurnSpeed;
 }
 public static ApiShip ToApiShip(this Ship ship, ApiPlayerRole role)
 {
     return(new ApiShip
     {
         Role = role,
         ShipId = ship.Uid,
         Position = ship.Position,
         Velocity = ship.Velocity,
         Matter = ship.Matter.ToApiShipMatter(),
         Temperature = ship.Temperature,
         MaxFuelBurnSpeed = ship.MaxFuelBurnSpeed,
         CriticalTemperature = ship.CriticalTemperature
     });
 }
Ejemplo n.º 4
0
 public PlanetWarsState(long level, PlanetWarsStatus status, long playerKey, ApiPlayerRole myRole, long totalScore, ApiPlayerStatus gameResultStatus, ApiShip selectedShip, IEnumerable <ApiShipCommand> commands, ApiCommandType editingCommand, ApiUniverse universe, ApiJoinGameInfo gameJoinInfo, ApiGameLog gameLog, ApiShipMatter shipMatter)
 {
     Level            = level;
     Status           = status;
     PlayerKey        = playerKey;
     MyRole           = myRole;
     TotalScore       = totalScore;
     GameResultStatus = gameResultStatus;
     SelectedShip     = selectedShip;
     Commands         = commands;
     EditingCommand   = editingCommand;
     Universe         = universe;
     GameJoinInfo     = gameJoinInfo;
     GameLog          = gameLog;
     ShipMatter       = shipMatter;
 }
        public GameStateMachinePlayer(PlanetWarsServerSettings settings, int playerId, ApiPlayerRole role, InternalLogger internalLogger, CancellationToken cancellationToken)
        {
            this.settings            = settings;
            totalCommandsTimeoutLeft = settings.TotalCommandsTimeout;
            this.internalLogger      = internalLogger;
            this.cancellationToken   = cancellationToken;
            PlayerKey = ThreadLocalRandom.Instance.NextLong();
            PlayerId  = playerId;
            Role      = role;
            Stats     = new ApiPlayerStats
            {
                PlayerKey = PlayerKey,
                Role      = role,
                Status    = ApiPlayerStatus.NotJoined
            };

            join  = new Operation <JoinArg, GameProtocolResult>(cancellationToken);
            start = new Operation <StartArg, GameProtocolResult>(cancellationToken);
            start.TrySetRequestFaulted();
            commands = new Operation <CommandsArg, GameProtocolResult>(cancellationToken);
            commands.TrySetRequestFaulted();
            currentTask = join.WaitForResponseAsync();
        }
Ejemplo n.º 6
0
 public ApiPlayer(ApiPlayerRole role, long playerKey)
 {
     Role      = role;
     PlayerKey = playerKey;
 }
Ejemplo n.º 7
0
 public ApiPlayerInfo(ApiPlayerRole role, long score, ApiPlayerStatus status)
 {
     Role   = role;
     Score  = score;
     Status = status;
 }