public SiegeWeaponDeploymentAI( List <DeploymentPoint> deploymentPoints, SiegeWeaponCollection availableWeapons) { this.deploymentPoints = deploymentPoints; this.weapons = availableWeapons; }
public SiegeWeaponDeploymentAI( List <DeploymentPoint> deploymentPoints, Dictionary <System.Type, int> availableWeapons) { this.deploymentPoints = deploymentPoints; this.weapons = new SiegeWeaponCollection(availableWeapons); }
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(); } } }
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); }
public SiegeDeploymentHandler(bool isPlayerAttacker, Dictionary <System.Type, int> weaponTypeAndCounts) : base(isPlayerAttacker) { this._weapons = new SiegeWeaponCollection(weaponTypeAndCounts); }
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));
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); }