コード例 #1
0
ファイル: TeamOperation.cs プロジェクト: vvnurmi/assaultwing
 public static TeamOperation CreateToExistingTeam(Team existingTeam, string newSpectatorName)
 {
     return new TeamOperation
     {
         Type = ChoiceType.CreateToExistingTeam,
         ExistingTeam = existingTeam,
         NewSpectatorName = newSpectatorName,
     };
 }
コード例 #2
0
ファイル: TeamOperation.cs プロジェクト: vvnurmi/assaultwing
 public static TeamOperation AssignToExistingTeam(Team existingTeam, Spectator existingSpectator)
 {
     return new TeamOperation
     {
         Type = ChoiceType.AssignToExistingTeam,
         ExistingTeam = existingTeam,
         ExistingSpectator = existingSpectator,
     };
 }
コード例 #3
0
 public void Setup()
 {
     Spectator.CreateStatsData = spectator => new MockStats();
     _gameplayMode = new GameplayMode(lifeScore: 1, killScore: 4, deathScore: -2, damageCombatPoints: 0, bonusesCombatPoints: 0);
     _team1 = new Team("Avengers", null) { ID = 11 };
     _team2 = new Team("X-Men", null) { ID = 12 };
     _team3 = new Team("Autobots", null) { ID = 13 };
     _team4 = new Team("Decepticons", null) { ID = 14 };
     _player1 = new Player(null, "Player 1", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()) { ID = 1 };
     _player2 = new Player(null, "Player 2", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()) { ID = 2 };
     _player3 = new Player(null, "Player 3", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()) { ID = 3 };
     _player4 = new Player(null, "Player 4", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()) { ID = 4 };
     _player5 = new Player(null, "Player 5", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()) { ID = 5 };
     _player6 = new Player(null, "Player 6", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()) { ID = 6 };
 }
コード例 #4
0
ファイル: TeamTest.cs プロジェクト: vvnurmi/assaultwing
 public void Setup()
 {
     CanonicalString.IsForLocalUseOnly = true;
     Spectator.CreateStatsData = spectator => new MockStats();
     _arena = new Arena();
     _ship1 = new Ship((CanonicalString)"Bugger") { Owner = _player1, MaxDamageLevel = 100, Arena = _arena };
     _ship2 = new Ship((CanonicalString)"Bugger") { Owner = _player2, MaxDamageLevel = 100, Arena = _arena };
     _ship3 = new Ship((CanonicalString)"Bugger") { Owner = _player3, MaxDamageLevel = 100, Arena = _arena };
     _avengers = new Team("Avengers", null);
     _xmen = new Team("X-Men", null);
     _player1 = new Player(null, "Player 1", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls());
     _player2 = new Player(null, "Player 2", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls());
     _player3 = new Player(null, "Player 3", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls());
     SeizeShip(_player1, _ship1);
     SeizeShip(_player2, _ship2);
     SeizeShip(_player3, _ship3);
 }
コード例 #5
0
ファイル: CoronerTest.cs プロジェクト: vvnurmi/assaultwing
 public void Setup()
 {
     Spectator.CreateStatsData = spectator => new MockStats();
     Coroner.ResetPhraseSets();
     _avengers = new Team("Avengers", null);
     _player1 = new Player(null, "Player 1", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls());
     _player2 = new Player(null, "Player 2", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls());
     _player3 = new Player(null, "Player 3", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls());
     _player4 = new Player(null, "Player 4", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls());
     _player1.AssignTeam(_avengers);
     _player4.AssignTeam(_avengers);
     _arena = new Arena();
     _gob1 = new Gob { Owner = _player1, MaxDamageLevel = 100, Arena = _arena };
     _gob1DamagedBy2 = new Gob { Owner = _player1, MaxDamageLevel = 100, Arena = _arena };
     _gob2 = new Gob { Owner = _player2, MaxDamageLevel = 100, Arena = _arena };
     _gob2Nature = new Gob { Owner = null };
     _gob4 = new Gob { Owner = _player4, MaxDamageLevel = 100, Arena = _arena };
     _arena.TotalTime = TimeSpan.FromSeconds(10);
     _gob1DamagedBy2.InflictDamage(10, new DamageInfo(_gob2));
 }
コード例 #6
0
ファイル: DamageInfoTest.cs プロジェクト: vvnurmi/assaultwing
 public void Setup()
 {
     _arena = new Arena();
     _avengers = new Team("Avengers", null);
     _player1 = new Player(null, "Player 1", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls());
     _player2 = new Player(null, "Player 2", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls());
     _player3 = new Player(null, "Player 3", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls());
     _player2.AssignTeam(_avengers);
     _player3.AssignTeam(_avengers);
     _gob1 = new Gob { ID = 10, Owner = _player1, MaxDamageLevel = 100, Arena = _arena };
     _gob1DamagedBy2 = new Gob { ID = 11, Owner = _player1, MaxDamageLevel = 100, Arena = _arena };
     _gob2 = new Gob { ID = 2, Owner = _player2, MaxDamageLevel = 100, Arena = _arena };
     _gob3 = new Gob { ID = 3, Owner = _player3, MaxDamageLevel = 100, Arena = _arena };
     _gobNature = new Gob { ID = 4, Owner = null, MaxDamageLevel = 100, Arena = _arena };
     _info1Hit1 = new DamageInfo(_gob1).Bind(_gob1);
     _info2Hit1 = new DamageInfo(_gob2).Bind(_gob1);
     _info3Hit2 = new DamageInfo(_gob3).Bind(_gob2);
     _infoNatureHit1 = new DamageInfo(_gobNature).Bind(_gob1);
     _arena.TotalTime = TimeSpan.FromSeconds(10);
     _gob1DamagedBy2.InflictDamage(10, new DamageInfo(_gob2));
     _info1DamagedBy2 = DamageInfo.Unspecified.Bind(_gob1DamagedBy2);
 }
コード例 #7
0
ファイル: Spectator.cs プロジェクト: vvnurmi/assaultwing
 /// <summary>
 /// Assigns the spectator to a team. The spectator will resign any previous team.
 /// </summary>
 public void AssignTeam(Team team)
 {
     var oldTeam = Team;
     Team = team;
     if (oldTeam != null) oldTeam.UpdateAssignment(this);
     if (Team != null) Team.UpdateAssignment(this);
 }
コード例 #8
0
 public void WriteID(Team team)
 {
     checked
     {
         var id = team == null ? Team.UNINITIALIZED_ID : team.ID;
         Write((sbyte)id);
     }
 }
コード例 #9
0
 private void HandleTeamSettingsMessageOnClient(TeamSettingsMessage mess)
 {
     mess.Read(id =>
         {
             var team = Game.DataEngine.FindTeam(id);
             if (team == null) Game.DataEngine.Teams.Add(team = new Team("<uninitialised>", Game.DataEngine.FindSpectator) { ID = id });
             return team;
         },
         SerializationModeFlags.ConstantDataFromServer | SerializationModeFlags.VaryingDataFromServer, 0);
     // Remove teams that were not mentioned in the message.
     if (mess.IDs.Count() != Game.DataEngine.Teams.Count)
         Game.DataEngine.Teams.Remove(team => !mess.IDs.Contains(team.ID));
 }
コード例 #10
0
ファイル: GameplayMode.cs プロジェクト: vvnurmi/assaultwing
 public int Rate(Team team)
 {
     return team.Members.Sum(spec => Rate(spec));
 }