Esempio n. 1
0
 public override void AfterStart()
 {
     this.Mission.MakeDeploymentPlan();
     this._missionScoreboardComponent = this.Mission.GetMissionBehaviour <MissionScoreboardComponent>();
     this._gameMode        = this.Mission.GetMissionBehaviour <MissionMultiplayerGameModeBase>();
     this._timerComponent  = this.Mission.GetMissionBehaviour <MultiplayerTimerComponent>();
     this._roundComponent  = this.Mission.GetMissionBehaviour <IRoundComponent>();
     this._warmupComponent = this.Mission.GetMissionBehaviour <MultiplayerWarmupComponent>();
 }
Esempio n. 2
0
 public override void OnBehaviourInitialize()
 {
     base.OnBehaviourInitialize();
     this._scoreboardComponent = Mission.Current.GetMissionBehaviour <MissionScoreboardComponent>();
     this._currentGameType     = MultiplayerOptions.OptionType.NumberOfBotsPerFormation.GetIntValue() > 0 ? MissionLobbyComponent.MultiplayerGameType.Captain : MissionLobbyComponent.MultiplayerGameType.Skirmish;
     this.ResetTeamPowers();
     this._capturePointOwners = new Team[3];
     this.AllCapturePoints    = Mission.Current.MissionObjects.FindAllWithType <FlagCapturePoint>();
     this.RoundComponent.OnPreparationEnded   += new Action(this.OnPreparationEnded);
     NetworkCommunicator.OnPeerComponentAdded += new Action <PeerComponent>(this.OnPeerComponentAdded);
 }
Esempio n. 3
0
        private void HandleServerEventMissionStateChange(MissionStateChange message)
        {
            if (message.CurrentState != MissionLobbyComponent.MultiplayerGameState.Ending || this._recordedHistory)
            {
                return;
            }
            MissionScoreboardComponent missionBehaviour = this.Mission.GetMissionBehaviour <MissionScoreboardComponent>();

            if (missionBehaviour != null)
            {
                int roundScore1 = missionBehaviour.GetRoundScore(BattleSideEnum.Attacker);
                int roundScore2 = missionBehaviour.GetRoundScore(BattleSideEnum.Defender);
                this._matchInfo.WinnerTeam    = roundScore1 > roundScore2 ? 0 : (roundScore1 == roundScore2 ? -1 : 1);
                this._matchInfo.AttackerScore = roundScore1;
                this._matchInfo.DefenderScore = roundScore2;
            }
            MatchHistory.AddMatch(this._matchInfo);
            MatchHistory.Serialize();
            this._recordedHistory = true;
        }
Esempio n. 4
0
 public override void OnRemoveBehaviour()
 {
     if (!this._recordedHistory)
     {
         this._matchInfo.WinnerTeam = -1;
         MissionScoreboardComponent missionBehaviour = this.Mission.GetMissionBehaviour <MissionScoreboardComponent>();
         if (missionBehaviour != null)
         {
             int roundScore1 = missionBehaviour.GetRoundScore(BattleSideEnum.Attacker);
             int roundScore2 = missionBehaviour.GetRoundScore(BattleSideEnum.Defender);
             this._matchInfo.AttackerScore = roundScore1;
             this._matchInfo.DefenderScore = roundScore2;
         }
         MatchHistory.AddMatch(this._matchInfo);
         MatchHistory.Serialize();
         this._recordedHistory = true;
     }
     MissionPeer.OnTeamChanged -= new MissionPeer.OnTeamChangedDelegate(this.TeamChange);
     base.OnRemoveBehaviour();
 }
Esempio n. 5
0
 public override void OnBehaviourInitialize()
 {
     base.OnBehaviourInitialize();
     this._missionScoreboardComponent = this.Mission.GetMissionBehaviour <MissionScoreboardComponent>();
 }