コード例 #1
0
 public SiegeWeaponDeploymentAI(
     List <DeploymentPoint> deploymentPoints,
     SiegeWeaponCollection availableWeapons)
 {
     this.deploymentPoints = deploymentPoints;
     this.weapons          = availableWeapons;
 }
コード例 #2
0
 public SiegeWeaponDeploymentAI(
     List <DeploymentPoint> deploymentPoints,
     Dictionary <System.Type, int> availableWeapons)
 {
     this.deploymentPoints = deploymentPoints;
     this.weapons          = new SiegeWeaponCollection(availableWeapons);
 }
コード例 #3
0
        private void RemoveUnavailableDeploymentPoints(BattleSideEnum side)
        {
            SiegeWeaponCollection weapons = new SiegeWeaponCollection(side == BattleSideEnum.Attacker ? this._availableSiegeWeaponsOfAttackers : this._availableSiegeWeaponsOfDefenders);

            foreach (DeploymentPoint deploymentPoint in this.Mission.ActiveMissionObjects.FindAllWithType <DeploymentPoint>().Where <DeploymentPoint>((Func <DeploymentPoint, bool>)(dp => dp.Side == side)).ToArray <DeploymentPoint>())
            {
                if (!deploymentPoint.DeployableWeaponTypes.Any <Type>((Func <Type, bool>)(wt => weapons.GetMaxDeployableWeaponCount(wt) > 0)))
                {
                    foreach (SynchedMissionObject synchedMissionObject in deploymentPoint.DeployableWeapons.Select <SynchedMissionObject, SiegeWeapon>((Func <SynchedMissionObject, SiegeWeapon>)(sw => sw as SiegeWeapon)))
                    {
                        synchedMissionObject.SetDisabledSynched();
                    }
                    deploymentPoint.SetDisabledSynched();
                }
            }
        }
コード例 #4
0
        private bool DeployWeaponFrom(DeploymentPoint dp)
        {
            IEnumerable <System.Type> source = dp.DeployableWeaponTypes.Where <System.Type>((Func <System.Type, bool>)(t => this.deploymentPoints.Count <DeploymentPoint>((Func <DeploymentPoint, bool>)(dep => dep.IsDeployed && SiegeWeaponCollection.GetWeaponType((ScriptComponentBehaviour)dep.DeployedWeapon) == t)) < this.weapons.GetMaxDeployableWeaponCount(t)));

            if (source.IsEmpty <System.Type>())
            {
                return(false);
            }
            System.Type t1 = source.MaxBy <System.Type, float>((Func <System.Type, float>)(t => this.GetWeaponValue(t)));
            dp.Deploy(t1);
            return(true);
        }
コード例 #5
0
 public SiegeDeploymentHandler(bool isPlayerAttacker, Dictionary <System.Type, int> weaponTypeAndCounts)
     : base(isPlayerAttacker)
 {
     this._weapons = new SiegeWeaponCollection(weaponTypeAndCounts);
 }
コード例 #6
0
 public int GetDeployableWeaponCount(System.Type weapon) => this._weapons.GetMaxDeployableWeaponCount(weapon) - this.DeploymentPoints.Count <DeploymentPoint>((Func <DeploymentPoint, bool>)(dp => dp.IsDeployed && SiegeWeaponCollection.GetWeaponType((ScriptComponentBehaviour)dp.DeployedWeapon) == weapon));
コード例 #7
0
 public void Deploy(System.Type t)
 {
     this.DeployedWeapon = this._weapons.First <SynchedMissionObject>((Func <SynchedMissionObject, bool>)(w => SiegeWeaponCollection.GetWeaponType((ScriptComponentBehaviour)w) == t));
     this.OnDeploymentStateChangedAux(this.DeployedWeapon);
     this.ToggleDeploymentPointVisibility(false);
     this.ToggleDeployedWeaponVisibility(true);
 }