Esempio n. 1
0
        public override bool MissionEnded(ref MissionResult missionResult)
        {
            bool flag = false;

            if (this._isEnemySideRetreating || this._isEnemySideDepleted)
            {
                missionResult = MissionResult.CreateSuccessful((IMission)this.Mission);
                flag          = true;
            }
            else if (this._isPlayerSideDepleted)
            {
                missionResult = MissionResult.CreateDefeated((IMission)this.Mission);
                flag          = true;
            }
            if (flag)
            {
                this._missionAgentSpawnLogic.StopSpawner();
            }
            return(flag);
        }
Esempio n. 2
0
        public override bool MissionEnded(ref MissionResult missionResult)
        {
            if (this.IsSallyOutOver)
            {
                missionResult = MissionResult.CreateSuccessful((IMission)this.Mission);
                return(true);
            }
            if (this._checkState != SallyOutEndLogic.EndConditionCheckState.Active)
            {
                return(false);
            }
            foreach (Team team in (ReadOnlyCollection <Team>) this.Mission.Teams)
            {
                switch (team.Side)
                {
                case BattleSideEnum.Defender:
                    if (team.FormationsIncludingSpecial.Any <Formation>() && team.Formations.Any <Formation>((Func <Formation, bool>)(f => !TeamAISiegeComponent.IsFormationInsideCastle(f, false, 0.9f))))
                    {
                        this._checkState = SallyOutEndLogic.EndConditionCheckState.Idle;
                        return(false);
                    }
                    continue;

                case BattleSideEnum.Attacker:
                    if (TeamAISiegeComponent.IsFormationGroupInsideCastle(team.FormationsIncludingSpecial, false, 0.1f))
                    {
                        this._checkState = SallyOutEndLogic.EndConditionCheckState.Idle;
                        return(false);
                    }
                    continue;

                default:
                    continue;
                }
            }
            this.IsSallyOutOver = true;
            missionResult       = MissionResult.CreateSuccessful((IMission)this.Mission);
            return(true);
        }
 public override bool MissionEnded(ref MissionResult missionResult)
 {
     if (!this.IsDeploymentFinished)
     {
         return(false);
     }
     if (this.IsPlayerDead())
     {
         missionResult = MissionResult.CreateDefeated((IMission)this.Mission);
         return(true);
     }
     if (this.Mission.GetMemberCountOfSide(BattleSideEnum.Attacker) == 0)
     {
         missionResult = this.Mission.PlayerTeam.Side == BattleSideEnum.Attacker ? MissionResult.CreateDefeated((IMission)this.Mission) : MissionResult.CreateSuccessful((IMission)this.Mission);
         return(true);
     }
     if (this.Mission.GetMemberCountOfSide(BattleSideEnum.Defender) != 0)
     {
         return(false);
     }
     missionResult = this.Mission.PlayerTeam.Side == BattleSideEnum.Attacker ? MissionResult.CreateSuccessful((IMission)this.Mission) : MissionResult.CreateDefeated((IMission)this.Mission);
     return(true);
 }