ActiveProtect/Program.cs

122 lines
5.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Threading;
using ActiveProtect.SimulationEnvironment;
using ActiveProtect.Models;
namespace ActiveProtect
{
class Program
{
static void Main(string[] args)
{
// 创建仿真配置
var config = new SimulationConfig
{
TankConfigs =
[
new() {
InitialPosition = new Vector3D(100, 0, 100),
InitialOrientation = new Orientation(0, 0, 0),
InitialSpeed = 0,
MaxSpeed = 20,
MaxArmor = 100
}
],
MissileConfigs =
[
// 标准导弹配置
new() {
InitialPosition = new Vector3D(1500, 200, 100),
InitialOrientation = new Orientation(Math.PI, -0.1, 0),
InitialSpeed = 10,
MaxSpeed = 400,
TargetIndex = 0,
MaxFlightTime = 0,
MaxFlightDistance = 5000,
ThrustAcceleration = 80,
MaxEngineBurnTime = 5,
MaxAcceleration = 100,
ProportionalNavigationCoefficient = 3,
StageConfig = Missile.FlightStageConfig.StandardMissile,
DistanceParams = new MissileDistanceParams(500, 100, 20),
Type = MissileType.StandardMissile
},
// 激光制导炮弹配置
new() {
InitialPosition = new Vector3D(2000, 150, 100),
InitialOrientation = new Orientation(Math.PI, -0.15, 0),
InitialSpeed = 700,
MaxSpeed = 800,
TargetIndex = 0,
MaxFlightTime = 0,
MaxFlightDistance = 5000,
ThrustAcceleration = 50,
MaxEngineBurnTime = 5,
MaxAcceleration = 100,
ProportionalNavigationCoefficient = 3,
StageConfig = Missile.FlightStageConfig.LaserGuidedShell,
DistanceParams = new MissileDistanceParams(300, 100, 20),
Type = MissileType.InfraredCommandGuidance
},
// 短程导弹配置
new() {
InitialPosition = new Vector3D(1000, 50, 100),
InitialOrientation = new Orientation(Math.PI, -0.05, 0),
InitialSpeed = 10,
MaxSpeed = 300,
TargetIndex = 0,
MaxFlightTime = 0,
MaxFlightDistance = 3000,
ThrustAcceleration = 50,
MaxEngineBurnTime = 5,
MaxAcceleration = 100,
ProportionalNavigationCoefficient = 3,
StageConfig = Missile.FlightStageConfig.ShortRangeMissile,
DistanceParams = new MissileDistanceParams(400, 100, 20),
Type = MissileType.MillimeterWaveTerminalGuidance
},
// 新增激光半主动制导导弹配置
new() {
InitialPosition = new Vector3D(1500, 150, 100),
InitialOrientation = new Orientation(Math.PI, -0.12, 0),
InitialSpeed = 700,
MaxSpeed = 800,
TargetIndex = 0,
MaxFlightTime = 20,
MaxFlightDistance = 4500,
ThrustAcceleration = 50,
MaxEngineBurnTime = 5,
MaxAcceleration = 100,
ProportionalNavigationCoefficient = 3,
StageConfig = Missile.FlightStageConfig.LaserSemiActiveGuidedMissile,
DistanceParams = new MissileDistanceParams(500, 200, 20),
Type = MissileType.SemiActiveLaserGuidance
}
],
LaserDesignatorConfigs =
[
new LaserDesignatorConfig
{
InitialPosition = new Vector3D(500, 50, 100),
TargetId = "Tank_1"
}
],
SimulationTimeStep = 0.05
};
// 创建仿真管理器
var simulationManager = new SimulationManager(config);
// 运行仿真
while (!simulationManager.IsSimulationEnded)
{
simulationManager.Update();
simulationManager.PrintStatus();
Thread.Sleep(100); // 暂停100毫秒使输出更易读
}
Console.WriteLine("仿真结束");
}
}
}