private void DetermineDeploymentPointType() { if (this._isBreachSideDeploymentPoint) { this._deploymentPointType = DeploymentPoint.DeploymentPointType.Breach; } else if (this._weapons.Any <SynchedMissionObject>((Func <SynchedMissionObject, bool>)(w => w is BatteringRam))) { this._deploymentPointType = DeploymentPoint.DeploymentPointType.BatteringRam; this.DeploymentTargetPosition = (this._weapons.First <SynchedMissionObject>((Func <SynchedMissionObject, bool>)(w => w is BatteringRam)) as IPrimarySiegeWeapon).TargetCastlePosition.GameEntity.GlobalPosition; } else if (this._weapons.Any <SynchedMissionObject>((Func <SynchedMissionObject, bool>)(w => w is SiegeTower))) { SiegeTower tower = this._weapons.FirstOrDefault <SynchedMissionObject>((Func <SynchedMissionObject, bool>)(w => w is SiegeTower)) as SiegeTower; this._deploymentPointType = DeploymentPoint.DeploymentPointType.TowerLadder; this.DeploymentTargetPosition = tower.TargetCastlePosition.GameEntity.GlobalPosition; this._associatedSiegeLadders = Mission.Current.ActiveMissionObjects.FindAllWithType <SiegeLadder>().Where <SiegeLadder>((Func <SiegeLadder, bool>)(sl => sl.WeaponSide == tower.WeaponSide)).ToList <SiegeLadder>(); } else { this._deploymentPointType = DeploymentPoint.DeploymentPointType.Ranged; this.DeploymentTargetPosition = Vec3.Invalid; } Action <DeploymentPoint> pointTypeDetermined = this.OnDeploymentPointTypeDetermined; if (pointTypeDetermined == null) { return; } pointTypeDetermined(this); }
protected internal override void TickOccasionally() { base.TickOccasionally(); if (this.formation.AI.Side != this.behaviourSide) { this.behaviourSide = this.formation.AI.Side; this._siegeTower = Mission.Current.ActiveMissionObjects.FindAllWithType <SiegeTower>().FirstOrDefault <SiegeTower>((Func <SiegeTower, bool>)(st => st.WeaponSide == this.behaviourSide)); } if (this._siegeTower == null || this._siegeTower.IsDestroyed) { return; } this.formation.MovementOrder = this.CurrentOrder; }
internal Vec3 CalculateSallyOutReferencePosition(FormationAI.BehaviorSide side) { switch (side) { case FormationAI.BehaviorSide.Left: SiegeTower siegeTower1 = this.SiegeTowers.FirstOrDefault <SiegeTower>((Func <SiegeTower, bool>)(st => st.WeaponSide == FormationAI.BehaviorSide.Left)); return(siegeTower1 == null ? this.Ram.GameEntity.GlobalPosition : siegeTower1.GameEntity.GlobalPosition); case FormationAI.BehaviorSide.Right: SiegeTower siegeTower2 = this.SiegeTowers.FirstOrDefault <SiegeTower>((Func <SiegeTower, bool>)(st => st.WeaponSide == FormationAI.BehaviorSide.Right)); return(siegeTower2 == null ? this.Ram.GameEntity.GlobalPosition : siegeTower2.GameEntity.GlobalPosition); default: return(this.Ram.GameEntity.GlobalPosition); } }
public BehaviorShootFromSiegeTower(Formation formation) : base(formation) { this.behaviourSide = formation.AI.Side; this._siegeTower = Mission.Current.ActiveMissionObjects.FindAllWithType <SiegeTower>().FirstOrDefault <SiegeTower>((Func <SiegeTower, bool>)(st => st.WeaponSide == this.behaviourSide)); }