private void ThinkFiringBeam() { if (this.m_BeamBank == null || this.m_CurrentTarget == null) { this.m_State = SystemKillerStates.SEEK; } else { if (this.m_SystemKiller.ListenTurretFiring == Turret.FiringEnum.Firing) { return; } if (this.m_SystemKiller.ListenTurretFiring == Turret.FiringEnum.Completed) { this.m_SystemKiller.PostSetProp("FullyHealShip"); if (this.m_CurrentTarget is StellarBody) { this.m_Planets.Remove(this.m_CurrentTarget as StellarBody); } else if (this.m_CurrentTarget is StarModel) { this.m_Stars.Remove(this.m_CurrentTarget as StarModel); } this.m_CurrentTarget = (IGameObject)null; this.m_VictoryConditionsMet = true; } this.m_State = SystemKillerStates.SEEK; } }
protected virtual void ThinkTrack() { if (this.m_CurrentTarget == null) { this.m_State = SystemKillerStates.SEEK; } else { --this.m_TrackUpdateRate; if (this.m_TrackUpdateRate > 0) { return; } this.m_TrackUpdateRate = 10; Vector3 vector3 = this.m_SystemKiller.Position - this.m_TargetCenter; double num = (double)vector3.Normalize(); Vector3 targetPos = this.m_TargetCenter + vector3 * this.m_PlanetOffsetDist; this.m_TargetLook = -vector3; this.m_SystemKiller.Maneuvering.PostAddGoal(targetPos, this.m_TargetLook); Matrix rotationYpr = Matrix.CreateRotationYPR(this.m_SystemKiller.Rotation); if (this.m_SystemKiller.Target == null || ((double)(this.m_SystemKiller.Position - targetPos).LengthSquared > 9000.0 || (double)Vector3.Dot(rotationYpr.Forward, this.m_TargetLook) <= 0.800000011920929)) { return; } if (this.m_BeamBank != null) { this.m_BeamBank.PostSetProp("DisableAllTurrets", false); } this.m_State = SystemKillerStates.FIREBEAM; } }
protected virtual void ThinkSeek() { if (this.m_CurrentTarget == null) { this.FindCurrentTarget(false); } else { this.m_State = SystemKillerStates.TRACK; } }
private void ThinkFireBeam() { if (this.m_BeamBank == null || this.m_CurrentTarget == null) { this.m_State = SystemKillerStates.SEEK; } else { if (this.m_SystemKiller.ListenTurretFiring != Turret.FiringEnum.Firing) { return; } this.m_State = SystemKillerStates.FIRINGBEAM; } }
private void ThinkSpaceBattle() { this.m_TargetCenter = Matrix.CreateRotationYPR(this.m_SystemKiller.Rotation).Forward *(((IEnumerable <float>)Kerberos.Sots.GameStates.StarSystem.CombatZoneMapRadii).Last <float>() * 5700f); this.m_TargetLook = this.m_SystemKiller.Position - this.m_TargetCenter; this.m_TargetLook.Y = 0.0f; double num = (double)this.m_TargetLook.Normalize(); Vector3 targetPos = this.m_TargetCenter + this.m_TargetLook * this.m_PlanetOffsetDist; this.m_SystemKiller.Maneuvering.PostAddGoal(targetPos, this.m_TargetLook); if ((double)(this.m_SystemKiller.Position - targetPos).LengthSquared > 90000.0) { return; } this.m_VictoryConditionsMet = true; this.m_State = SystemKillerStates.SEEK; }
public override void FindNewTarget(IEnumerable <IGameObject> objs) { this.m_SpaceBattle = true; List <StellarBody> source = new List <StellarBody>(); List <MoonData> moonDataList = new List <MoonData>(); List <StarModel> starModelList = new List <StarModel>(); foreach (IGameObject gameObject in objs) { if (gameObject is StellarBody) { StellarBody stellarBody = gameObject as StellarBody; source.Add(stellarBody); this.m_SpaceBattle = false; } else if (gameObject is StarModel) { StarModel starModel = gameObject as StarModel; starModelList.Add(starModel); this.m_SpaceBattle = false; } } foreach (StellarBody stellarBody in source) { foreach (OrbitalObjectInfo moon in this.m_Game.GameDatabase.GetMoons(stellarBody.Parameters.OrbitalID)) { OrbitalObjectInfo ooi = moon; moonDataList.Add(new MoonData() { ParentID = ooi.ParentID.Value, Moon = source.First <StellarBody>((Func <StellarBody, bool>)(x => x.Parameters.OrbitalID == ooi.ID)) }); } } foreach (MoonData moonData in moonDataList) { source.Remove(moonData.Moon); } this.m_Planets = source; this.m_Moons = moonDataList; this.m_Stars = starModelList; if (!this.m_SpaceBattle) { return; } this.m_State = SystemKillerStates.SPACEBATTLE; }