private static void FlyLista() { var jas39 = new AirPlane(seats: 5, pilots: 2); var jas40 = new AirPlane(seats: 7, pilots: 0); jas39.Seats = 5; var planes = new List<AirPlane>() {jas39, jas40}; }
//플레인 출생신고 public void AddPlane(AirPlane plane) { //지금추가되는 AirPlane 의 Tag 명 string tagName = plane.gameObject.tag; //기존에 없는 Key 니? if (this.airplaneMap.ContainsKey(tagName) == false) { //새로운리스트 만든다. List<AirPlane> newList = new List<AirPlane>(); //리스트에 AirPlane 추가 newList.Add(plane); //새로운리스트 Map 에 추가 this.airplaneMap.Add(tagName, newList); } //기존에 있는키니? else { //기존키에 푸쉬 this.airplaneMap[tagName].Add(plane); } /* if (plane.gameObject.tag == "Alience") this.aliencePlaneList.Add(plane); else if (plane.gameObject.tag == "Enemy") this.enemyPlaneList.Add(plane); */ }
// Use this for initialization void Start () { //내가붙은 게임오브젝트의 컴포넌트 중 AirPlane 타입의 컴포넌트 인스턴스를 얻어온다. //만약 없다면 null 이 리턴된다. //this.airPlane = this.gameObject.GetComponent<AirPlane>(); //내가붙은 게임오브젝트의 컴포넌트 중 AirPlane 타입의 컴포넌트 인스턴스를 얻어온다. //이때 리턴되는 타입이 Component 이기때문에 AirPlane 으로 as 형변환을한다. //만약 없다면 null 이 리턴된다. this.airPlane = this.gameObject.GetComponent(typeof(AirPlane)) as AirPlane; }
public int Add(AirPlane Entity) { return(this._IAirPlane.Add(Entity)); }
public void DrawDynamics(Graphics g, AirPlane ap, double dt) { DrawArrangement dr = new DrawArrangement(); Vector3D vec = new Vector3D(); //g.SetFont(new Font("Sansserif", 11)); //g.DrawString("��base[deg]:" + Jp.Maker1.Util.DispFormat.DoubleFormat(ap.interference.wf_epsilon / Math.PI * 180.0D, 2), 200, 88); //g.DrawString("��[deg]:" + Jp.Maker1.Util.DispFormat.DoubleFormat(ap.interference.wf_epsilon_htail / Math.PI * 180.0D, 2), 200, 100); //g.DrawString("CL:" + DispFormat.DoubleFormat(ap.interference.wing_cl, 2), 200, 76); //g.DrawString("AR:" + DispFormat.DoubleFormat(ap.interference.wing_ar, 2), 200, 64); //g.DrawString("WG K_STALL:" + Jp.Maker1.Util.DispFormat.DoubleFormat(ap.max_k_stall_wing, 2), 400, 64); //g.DrawString("HT K_STALL:" + Jp.Maker1.Util.DispFormat.DoubleFormat(ap.max_k_stall_htail, 2), 400, 76); int xx = 220; int y = 240; //g.SetFont(new Font("Sansserif", 0, 11)); int lr; for (lr = 0; lr < 2; lr++) { if (ap.elevator[0, lr].type != 0) { // g.DrawString("��e" + Jp.Maker1.Fsim.AirPlane.lrName[lr] + ":" + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(ap.elevator[0, lr].delta), 1), xx, y); y += 12; } } //g.SetFont(new Font("Sansserif", 11)); y = 150; int dy = 9; xx = 2; int i; for (i = 0; i < ap.n_wing; i++) { for (lr = 0; lr < ap.wing[i].n_lr; lr++) { for (int j = 0; j < ap.wing[i].n_wing_block; j++) { String str = "W" + j + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.wing[i].wp[j, lr].k_stall, 4); // g.DrawString(str, xx, y); y += dy; } } } y += 3; for (i = 0; i < ap.n_htail; i++) { for (lr = 0; lr < ap.htail[i].n_lr; lr++) { for (int j_0 = 0; j_0 < ap.htail[i].n_wing_block; j_0++) { String str_1 = "H" + j_0 + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.htail[i].wp[j_0, lr].k_stall, 4); // g.DrawString(str_1, xx, y); y += dy; } } } y += 3; for (i = 0; i < ap.n_vtail; i++) { for (lr = 0; lr < ap.vtail[i].n_lr; lr++) { for (int j_2 = 0; j_2 < ap.vtail[i].n_wing_block; j_2++) { String str_3 = "V" + j_2 + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.vtail[i].wp[j_2, lr].k_stall, 4); // g.DrawString(str_3, xx, y); y += dy; } } } y += 3; for (i = 0; i < ap.n_elevator; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.elevator[i, lr].type != 0) { String str_4 = "E" + i + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.elevator[i, lr].baseWingBlock.k_stall, 4); // g.DrawString(str_4, xx, y); y += dy; } } } y += 3; for (i = 0; i < ap.n_aileron; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.aileron[i, lr].type != 0) { String str_5 = "A" + i + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.aileron[i, lr].baseWingBlock.k_stall, 4); // g.DrawString(str_5, xx, y); y += dy; } } } y += 3; for (i = 0; i < ap.n_rudder; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.rudder[i, lr].type != 0) { String str_6 = "R" + i + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.rudder[i, lr].baseWingBlock.k_stall, 4); // g.DrawString(str_6, xx, y); y += dy; } } } //g.SetColor(Java.Awt.Color.green); //g.SetFont(new Font("Sansserif", 10)); dr.DrawAxis(g, 2.0D); double scale = 1.0D / ap.inp.m; for (i = 0; i < ap.n_wing; i++) { for (lr = 0; lr < ap.wing[i].n_lr; lr++) { for (int j_7 = 0; j_7 < ap.wing[i].n_wing_block; j_7++) { dr.DrawVector(g, ap.wing[i].wp[j_7, lr].ac, ap.wing[i].wp[j_7, lr].fv.SclProd(scale), "W" + j_7 + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_htail; i++) { for (lr = 0; lr < ap.htail[i].n_lr; lr++) { for (int j_8 = 0; j_8 < ap.htail[i].n_wing_block; j_8++) { dr.DrawVector(g, ap.htail[i].wp[j_8, lr].ac, ap.htail[i].wp[j_8, lr].fv.SclProd(scale), "H" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_vtail; i++) { for (lr = 0; lr < ap.vtail[i].n_lr; lr++) { for (int j_9 = 0; j_9 < ap.vtail[i].n_wing_block; j_9++) { dr.DrawVector(g, ap.vtail[i].wp[j_9, lr].ac, ap.vtail[i].wp[j_9, lr].fv.SclProd(scale), "V" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_elevator; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.elevator[i, lr].type != 0) { dr.DrawVector(g, ap.elevator[i, lr].baseWingBlock.ac, ap.elevator[i, lr].d_fv.SclProd(scale), "E" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_aileron; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.aileron[i, lr].type != 0) { dr.DrawVector(g, ap.aileron[i, lr].baseWingBlock.ac, ap.aileron[i, lr].d_fv.SclProd(scale), "A" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_rudder; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.rudder[i, lr].type != 0) { dr.DrawVector(g, ap.rudder[i, lr].baseWingBlock.ac, ap.rudder[i, lr].d_fv.SclProd(scale), "R" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_t_flap; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.t_flap[i, lr].type != 0) { dr.DrawVector(g, ap.t_flap[i, lr].baseWingBlock.ac, ap.t_flap[i, lr].d_fv.SclProd(scale), "F" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_fuselage; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.fuslage[i, lr].flag != 0) { dr.DrawVector(g, ap.fuslage[i, lr].ac, ap.fuslage[i, lr].fv.SclProd(scale), "F" + i + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_LandingGear; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.landing_gear[i, lr].flag == 0) { continue; } dr.DrawVector(g, ap.landing_gear[i, lr].pg, ap.landing_gear[i, lr].n_fv.SclProd(scale), "G" + i + AirPlane.lrName[lr]); dr.DrawVector(g, ap.landing_gear[i, lr].pg, ap.landing_gear[i, lr].f_fv.SclProd(scale), ""); dr.DrawVector(g, ap.landing_gear[i, lr].pa, ap.landing_gear[i, lr].a_fv.SclProd(scale), "G" + i + AirPlane.lrName[lr]); } } for (i = 0; i < ap.n_powerPlant; i++) { dr.DrawVector(g, ap.powerPlant[i].engine.GetPos(), ap.t_force.SclProd(scale), "E" + i); // g.SetColor(Java.Awt.Color.blue); if (ap.powerPlant[i].engine_type == 1) { dr.DrawVector(g, ((ReciprocatingEngine)ap.powerPlant[i].engine).ac, ((ReciprocatingEngine)ap.powerPlant[i].engine).wash_direction.SclProd(-5.0D), "WASH" + i); } } //g.SetColor(Color.Yellow); //g.SetFont(new Font("Sansserif", 10)); dr.DrawAxis(g, 2.0D); for (i = 0; i < ap.n_wing; i++) { for (lr = 0; lr < ap.wing[i].n_lr; lr++) { for (int j_10 = 0; j_10 < ap.wing[i].n_wing_block; j_10++) { dr.DrawVector(g, ap.wing[i].wp[j_10, lr].ac, ap.wing[i].wp[j_10, lr].vd.SclProd(0.03D), "W" + j_10 + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_htail; i++) { for (lr = 0; lr < ap.htail[i].n_lr; lr++) { for (int j_11 = 0; j_11 < ap.htail[i].n_wing_block; j_11++) { dr.DrawVector(g, ap.htail[i].wp[j_11, lr].ac, ap.htail[i].wp[j_11, lr].vd.SclProd(0.03D), "H" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_vtail; i++) { for (lr = 0; lr < ap.vtail[i].n_lr; lr++) { for (int j_12 = 0; j_12 < ap.vtail[i].n_wing_block; j_12++) { dr.DrawVector(g, ap.vtail[i].wp[j_12, lr].ac, ap.vtail[i].wp[j_12, lr].vd.SclProd(0.03D), "V" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_elevator; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.elevator[i, lr].type != 0) { dr.DrawVector(g, ap.elevator[i, lr].baseWingBlock.ac, ap.elevator[i, lr].baseWingBlock.vd.SclProd(0.03D), "E" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_aileron; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.aileron[i, lr].type != 0) { dr.DrawVector(g, ap.aileron[i, lr].baseWingBlock.ac, ap.aileron[i, lr].baseWingBlock.vd.SclProd(0.03D), "A" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_rudder; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.rudder[i, lr].type != 0) { dr.DrawVector(g, ap.rudder[i, lr].baseWingBlock.ac, ap.rudder[i, lr].baseWingBlock.vd.SclProd(0.03D), "R" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_fuselage; i++) { for (lr = 0; lr <= 1; lr++) { dr.DrawVector(g, ap.fuslage[i, lr].ac, ap.fuslage[i, lr].vd.SclProd(0.03D), "FUS" + i + AirPlane.lrName[lr]); } } // g.SetColor(Java.Awt.Color.black); // g.DrawString("TIRE M: " + PrintVal(ap.landing_gear[0, 0].tire.muX) + "/" + PrintVal(ap.landing_gear[0, 0].tire.muY), 150, 312); // g.DrawString("TIRE F': " + PrintVal(ap.landing_gear[0, 0].f_fv.x) + "/" + PrintVal(ap.landing_gear[0, 0].f_fv.y) + "/" + PrintVal(ap.landing_gear[0][0].f_fv.z), 150, 324); // g.DrawString("FLAG LAND': " + ap.flag_land, 150, 336); // g.SetColor(Color.Red); if (ap.n_htail > 0) { for (lr = 0; lr < ap.htail[0].n_lr; lr++) { dr.DrawVector(g, ap.htail[0].wp[0, lr].ac, ap.interference.htail_dv[lr].SclProd(-0.03D), "IH" + i + AirPlane.lrName[lr]); } } if (ap.n_vtail > 0) { for (lr = 0; lr < ap.vtail[0].n_lr; lr++) { dr.DrawVector(g, ap.vtail[0].wp[0, lr].ac, ap.interference.vtail_dv[lr].SclProd(-0.03D), "IV" + i + AirPlane.lrName[lr]); } } for (i = 0; i < ap.n_fuselage; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.fuslage[i, lr].flag != 0) { dr.DrawVector(g, ap.fuslage[i, lr].ac, ap.interference.fuselage_dv[i, lr].SclProd(-0.03D), "IF" + i + AirPlane.lrName[lr]); } } } }
public void Calc_dynamics(AirPlane ap, double dt) { engine.Calc_dynamics(ap, dt); fv = engine.GetForce(); tv = engine.GetTorque(); }
internal void Calc_dynamics(int lr, AirPlane ap, double dt) { n_fv.SetVec(0.0D, 0.0D, 0.0D); n_tv.SetVec(0.0D, 0.0D, 0.0D); f_fv.SetVec(0.0D, 0.0D, 0.0D); f_tv.SetVec(0.0D, 0.0D, 0.0D); a_fv.SetVec(0.0D, 0.0D, 0.0D); a_tv.SetVec(0.0D, 0.0D, 0.0D); if (flag == 0) { return; } p0g.SetVec(AirPlane.Get_point(p0_base, lr).Sub(ap.inp.cg)); p0w.SetVec(AirPlane.Get_point(p0_base, lr).R2l().MultMat(ap.pMotion.owm).L2r()); vd = Dynamics.VWithRot(ap.pMotion.vc, ap.pMotion.omega, p0g); if ((p0w.z > 0.0D) && (delta == 1.0D)) { flag_land = 1; } else { flag_land = 0; } stroke_b = stroke; pw.SetVec(p0w.x, p0w.y, 0.0D); if (flag_land == 1) { pg = pw.R2l().MultMat(ap.pMotion.wom).L2r(); stroke = p0w.z; } else { pg.SetVec(p0g); stroke = 0.0D; } d_stroke = ((stroke - stroke_b) / dt); if (delta == 1.0D) { if (flag_land == 1) { fz = (-stroke * k_sus - d_stroke * c_sus); if (fz > 0.0D) { fz = 0.0D; } } else { fz = 0.0D; } n_fv = ap.pMotion.dg.SclProd(fz); n_tv = Dynamics.Torque(pg, n_fv); Matrix44 otm = new Matrix44(); Matrix44 tom = new Matrix44(); Matrix44 rxmat = new Matrix44(); Matrix44 rymat = new Matrix44(); rymat.SetRyMat(ap.pMotion.pitch.GetValue()); rxmat.SetRyMat(ap.pMotion.roll.GetValue()); tom = rxmat.MultMat(rymat); rymat.SetRyMat(-ap.pMotion.pitch.GetValue()); rxmat.SetRyMat(-ap.pMotion.roll.GetValue()); otm = rymat.MultMat(rxmat); tire.Update(vd.MultMat(otm), -fz, 1.0D, brake); if (flag_land == 1) { f_fv.SetVec(tire.fx, tire.fy, 0.0D); f_fv = f_fv.MultMat(tom); f_tv = f_tv.Add(Dynamics.Torque(pg, f_fv)); } } pa.SetVec(AirPlane.Get_point(sa.LinearIntarp(delta), lr).Sub(ap.inp.cg)); vd = Dynamics.VWithRot(ap.pMotion.vc, ap.pMotion.omega, pa); vpa = vd.Length(); q = (0.5D * ap.atmos.rho * vpa * vpa); if (delta != 0.0D) { d = (q * cd_s); a_fv = vd.NmlVec().SclProd(-d); a_tv = a_tv.Add(Dynamics.Torque(pa, a_fv)); } }
public void DrawInstrument(Graphics g, AirPlane ap, SimulatorInterface simif, double dt) { Matrix44 tmat = new Matrix44(); Matrix44 smat = new Matrix44(); Matrix44 rmat = new Matrix44(); Matrix44 rzmat = new Matrix44(); Matrix44 rxmat = new Matrix44(); Matrix44 mat = new Matrix44(); Scine scine = new Scine(); //g.SetColor(informationColor); //g.SetFont(stdFont); SolidBrush informationBrush = new SolidBrush(informationColor); Pen informationPen = new Pen(informationColor); g.DrawString(ap.plane.name, stdFont, informationBrush, 300 - ap.plane.name.Length * 3, 365); if (simif.dispInformationSw == 1) { double x = ap.pMotion.ov.Length(); //g.DrawString("V: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x, 3, 1) + " m/s", v_true_x, v_true_y); //g.DrawString("V: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.Mps2kmph(x), 3, 1) + " km/h", v_true_x, v_true_y + 12); //g.DrawString("V: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.Mps2kt(x), 3, 1) + " kt", v_true_x, v_true_y + 24); x = ap.pMotion.wpos.y; //g.DrawString("ALT: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x, 5, 1) + " m", alt_x, alt_y); //g.DrawString("ALT: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.M2ft(x), 5, 1) + " ft", alt_x, alt_y + 12); } double pitch = ap.pMotion.pitch.GetValue(); double roll = ap.pMotion.roll.GetValue(); g.DrawString("PIT: " + DispFormat.DoubleFormat(MathTool.RadToDeg(pitch), 5, 1) + " deg", stdFont, informationBrush, 515, 12); g.DrawString("ROL: " + DispFormat.DoubleFormat(MathTool.RadToDeg(roll), 5, 1) + " deg", stdFont, informationBrush, 512, 89); tmat.SetTMat(550.0D, 45.0D, 0.0D); smat.SetSMat(30.0D, -30.0D, 0.0D); if ((roll > 1.570796326794897D) || (roll < -1.570796326794897D)) { rmat.SetRzMat(Math.PI - pitch); } else { rmat.SetRzMat(pitch); } mat = smat.MultMat(rmat).MultMat(tmat); scine.Add(pitch_miniature_aircraft.Transform(mat)); g.DrawEllipse(informationPen, 520, 15, 60, 60); tmat.SetTMat(550.0D, 121.0D, 0.0D); smat.SetSMat(30.0D, -30.0D, 0.0D); rmat.SetRzMat(-roll); mat = smat.MultMat(rmat).MultMat(tmat); scine.Add(roll_miniature_aircraft.Transform(mat)); g.DrawEllipse(informationPen, 520, 91, 60, 60); if (simif.dispInformationSw == 1) { double x_0 = ap.atmos.h; //g.DrawString("H': " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0, 5, 1) + " m'", atmo_x, atmo_y); x_0 = ap.atmos.tc; //g.DrawString("t: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0, 4, 1) + " ��", atmo_x, atmo_y + 12); x_0 = ap.atmos.t; //g.DrawString("T: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0, 4, 1) + " K", atmo_x, atmo_y + 24); x_0 = ap.atmos.p; //g.DrawString("p: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0 / 100.0D, 4, 1) + " hPa", atmo_x + 90, atmo_y); x_0 = ap.atmos.rho; //g.DrawString("��: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0, 1, 3) + " kg/m3", atmo_x + 90, atmo_y + 12); x_0 = ap.atmos.a; // g.DrawString("a: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0, 3, 1) + " m/sec", atmo_x + 90, atmo_y + 24); } double alpha = ap.pMotion.alpha; double beta = ap.pMotion.beta; if (simif.dispInformationSw == 1) { //g.DrawString("��: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(alpha), 3, 1) + " deg", 2, 60); // g.DrawString("��: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(beta), 3, 1) + " deg", 2, 72); } Vector3D vec = ap.pMotion.ov.SclProd(60000000.0D).MultMat(ap.pilot.ViewMatrix()); if ((vec != null) && (vec.z > 0.0D)) { vec = proj.Project(vec); tmat.SetTMat(vec.x, vec.y, vec.z); scine.Add(velocity_vector.Transform(tmat)); } vec.SetVec(0.0D, 0.0D, 60000000.0D); vec = vec.MultMat(ap.pilot.ViewMatrix()); if ((vec != null) && (vec.z > 0.0D)) { vec = proj.Project(vec); tmat.SetTMat(vec.x, vec.y, vec.z); scine.Add(front_point.Transform(tmat)); } vec = ap.pMotion.force.R2l().SclProd(-1.0D / ap.inp.m); vec.z = 0.0D; double x_1 = vec.Length(); Vector3D vec2 = vec.NmlVec().SclProd(50.0D); vec = vec.NmlVec().SclProd(100.0D); Vector3D vec3 = vec.NmlVec().SclProd(113.0D); Jp.Maker1.Util.Symbol.DrawArrow(g, 300 + (int)vec2.x, 200 - (int)vec2.y, 300 + (int)vec.x, 200 - (int)vec.y, 50.0D, x_1 * 4.0D); //g.DrawString(Jp.Maker1.Util.DispFormat.DoubleFormat(x_1 / 9.80655D, 2) + "G", 286 + (int)vec3.x, 200 - (int)vec3.y); vec = ap.pMotion.force.R2l().SclProd(-1.0D / ap.inp.m); x_1 = vec.z; // g.DrawString(Jp.Maker1.Util.DispFormat.DoubleFormat(x_1 / 9.80655D, 2) + "G", 120, 192); if (Math.Abs((int)(x_1 * 10.0D)) >= 1) { Jp.Maker1.Util.Symbol.DrawArrow(g, 150, 200, 150 + (int)(x_1 * 10.0D), 200, (int)(Math.Abs(x_1) * 10.0D), 10.0D); Jp.Maker1.Util.Symbol.DrawArrow(g, 450, 200, 450 - (int)(x_1 * 10.0D), 200, (int)(Math.Abs(x_1) * 10.0D), 10.0D); } int xx = 2; int yy = 100; vec = ap.pMotion.force.SclProd(-1.0D / ap.inp.m / 9.80655D); if (simif.dispInformationSw == 1) { //g.DrawString("Gx: " + Jp.Maker1.Util.DispFormat.DoubleFormat(vec.x, 2, 4) + " [G]", xx, yy); yy += 11; // g.DrawString("Gy: " + Jp.Maker1.Util.DispFormat.DoubleFormat(vec.y, 2, 4) + " [G]", xx, yy); yy += 11; //g.DrawString("Gz: " + Jp.Maker1.Util.DispFormat.DoubleFormat(vec.z, 2, 4) + " [G]", xx, yy); yy += 11; } if (ap.max_k_stall_wing > 1.0D) { //g.DrawString("STALL", stallAlert_x + 25, stallAlert_y); } else if (ap.max_k_stall_wing > 0.95D) { //g.DrawString("STALL WARNING", stallAlert_x, stallAlert_y); } //g.SetColor(instrumentColor); double yaw = ap.pMotion.yaw.GetValue(); //g.DrawString("HDG: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(yaw), 5, 1) + " deg", 512, 165); tmat.SetTMat(550.0D, 197.0D, 0.0D); smat.SetSMat(30.0D, 30.0D, 0.0D); rmat.SetRzMat(yaw); mat = smat.MultMat(rmat).MultMat(tmat); scine.Add(heading_miniature_aircraft.Transform(mat)); // g.DrawOval(520, 167, 60, 60); rzmat.SetRzMat(-ap.pMotion.roll.GetValue()); rxmat.SetRxMat(-ap.pMotion.pitch.GetValue()); mat = rxmat.MultMat(rzmat); Scine scine2 = new Scine(); scine2.Add(artificial_horizon.Transform(mat.MultMat(ap.pilot.ViewMatrix()))); Scine view = new Scine(); view = scine2.MakeView(clip, proj, false); view.Draw(g); // g.SetFont(bigFont); x_1 = ap.pMotion.vc.Length() * Math.Sqrt(ap.atmos.rho / 1.225D); // g.DrawString("ASI: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.Mps2kt(x_1), 3, 0) + " kt", 190, 380); x_1 = ap.pMotion.wpos.y; //g.DrawString("ALT: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.M2ft(x_1), 5, 0) + " ft", 190, 396); x_1 = ap.pMotion.wv.y; //g.DrawString("VSI: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.M2ft(x_1) * 60.0D, 5, 0) + " fpm", 305, 380); x_1 = ap.pMotion.omega.z; // g.DrawString("YRT: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(x_1) * 60.0D, 3, 0) + " deg/m", 305, 396); for (int i = 0; i < ap.n_LandingGear; i++) { if (ap.landing_gear[i, 1].flag == 1) { xx = gear_x; } else { xx = gear_x - gear_box_maegine / 2; } yy = gear_y + i * gear_box_maegine * 3; for (int lr = 0; lr <= 1; lr++) { if (ap.landing_gear[i, lr].flag == 1) { int xx1; if (lr == 0) { xx1 = xx + gear_box_maegine; } else { xx1 = xx; } x_1 = ap.landing_gear[i, lr].delta; if (x_1 == 0.0D) { //g.SetColor(instrumentRed); //g.FillRect(xx1 + 2, yy + 2, gear_box_size - 3, gear_box_size - 3); } else if (x_1 == 1.0D) { //g.SetColor(instrumentGreen); //g.FillRect(xx1 + 2, yy + 2 + gear_box_maegine * 2, gear_box_size - 3, gear_box_size - 3); } else { // g.SetColor(instrumentYellow); // g.FillRect(xx1 + 2, yy + 2 + gear_box_maegine, gear_box_size - 3, gear_box_size - 3); } //g.SetColor(instrumentColor); //g.DrawRect(xx1, yy, gear_box_size, gear_box_size); //g.DrawRect(xx1, yy + gear_box_maegine, gear_box_size, gear_box_size); //g.DrawRect(xx1, yy + gear_box_maegine * 2, gear_box_size, gear_box_size); } } } //g.SetFont(smallFont); ControlPlane flap = ap.t_flap[0, 0]; if (ap.t_flap[0, 0].type != 0) { xx = flap_x; yy = flap_y; // g.DrawRect(xx, yy - flap_width, 10, flap_width); for (double ang = 0.0D; ang < MathTool.RadToDeg(flap.delta_max) + 0.1D; ang += 10.0D) { x_1 = (MathTool.DegToRad(ang) - flap.delta_min) / (flap.delta_max - flap.delta_min); int yy1 = yy - flap_width + (int)(flap_width * x_1 + 0.5D); // g.DrawLine(xx + 10, yy1, xx + 13, yy1); // g.DrawString("" + (int)ang, xx + 14, yy1); } x_1 = (flap.delta - flap.delta_min) / (flap.delta_max - flap.delta_min); int yy1_2 = (int)(flap_width * x_1 + 0.5D); // g.FillRect(xx + 2, yy - flap_width, 7, yy1_2); } //g.SetFont(stdFont); scine.Draw(g); //g.SetFont(stdFont); }
public void KeyPressed(Keys keyCode, AirPlane ap, SimulatorInterface simIF, Recorder recorder, PadlockObjectList pobj) { if (keyCode == simIF.key_ctrl) { simIF.ctrl_sw = 1; } if ((keyCode == simIF.key_pause) && (simIF.mode == 0)) { if (simIF.pause_sw == 0) { simIF.pause_sw = 1; } else { simIF.pause_sw = 0; simIF.locusMake = 1; simIF.locusImageMake = 1; } } if (keyCode == simIF.key_locus_disp) { simIF.pause_sw = 1; if (simIF.mode == 0) { simIF.mode = 1; } else if (simIF.mode == 1) { simIF.mode = 0; } } if (keyCode == simIF.key_menu) { simIF.pause_sw = 1; if (simIF.mode == 0) { simIF.mode = 2; } } if (keyCode == simIF.key_locus_reset) { recorder.Reset(); simIF.locusMake = 1; simIF.locusImageMake = 1; Jp.Maker1.Util.Gui.Caption.SetCaption("RECORDER RESET", 2.0D); } if (simIF.mode == 0) { if (keyCode == simIF.key_slow) { if (simIF.slow_mode == 0) { simIF.slow_mode = 1; } else { simIF.slow_mode = 0; } } if (keyCode == simIF.key_dispDynamics) { if (simIF.dispDynamicsSw == 0) { simIF.dispDynamicsSw = 1; } else { simIF.dispDynamicsSw = 0; } } if (keyCode == simIF.key_dispInformation) { if (simIF.dispInformationSw == 0) { simIF.dispInformationSw = 1; } else { simIF.dispInformationSw = 0; } } } if ((simIF.mode == 0) && (simIF.pause_sw == 0)) { if (keyCode == ap.cif.key_rudder_center) { ap.cif.rudder_sw = 3; } if (keyCode == ap.cif.key_rudder_left) { ap.cif.rudder_sw = -1; } if (keyCode == ap.cif.key_rudder_right) { ap.cif.rudder_sw = 1; } if (keyCode == ap.cif.key_throttle_0p) { ap.cif.throttle_pos = 0.0D; } if (keyCode == ap.cif.key_throttle_10p) { ap.cif.throttle_pos = 0.1D; } if (keyCode == ap.cif.key_throttle_20p) { ap.cif.throttle_pos = 0.2D; } if (keyCode == ap.cif.key_throttle_30p) { ap.cif.throttle_pos = 0.3D; } if (keyCode == ap.cif.key_throttle_40p) { ap.cif.throttle_pos = 0.4D; } if (keyCode == ap.cif.key_throttle_50p) { ap.cif.throttle_pos = 0.5D; } if (keyCode == ap.cif.key_throttle_60p) { ap.cif.throttle_pos = 0.6D; } if (keyCode == ap.cif.key_throttle_70p) { ap.cif.throttle_pos = 0.7D; } if (keyCode == ap.cif.key_throttle_80p) { ap.cif.throttle_pos = 0.8D; } if (keyCode == ap.cif.key_throttle_90p) { ap.cif.throttle_pos = 0.9D; } if (keyCode == ap.cif.key_throttle_100p) { ap.cif.throttle_pos = 1.0D; } if (keyCode == ap.cif.key_throttle_full) { ap.cif.throttle_pos = 1.0D; } if (keyCode == ap.cif.key_throttle_up) { ap.cif.throttle_sw = 1; } if (keyCode == ap.cif.key_throttle_down) { ap.cif.throttle_sw = -1; } if (keyCode == ap.cif.key_mixture_full_rich) { ap.cif.mixture_pos = 1.0D; } if (keyCode == ap.cif.key_mixture_rich) { ap.cif.mixture_sw = 1; } if (keyCode == ap.cif.key_mixture_lean) { ap.cif.mixture_sw = -1; } if (keyCode == ap.cif.key_prop_pitch_max_low) { ap.cif.prop_pitch_pos = 1.0D; } if (keyCode == ap.cif.key_prop_pitch_low) { ap.cif.prop_pitch_sw = 1; } if (keyCode == ap.cif.key_prop_pitch_high) { ap.cif.prop_pitch_sw = -1; } if (keyCode == ap.cif.key_brake_right) { ap.cif.brakeRight_sw = 1; } if (keyCode == ap.cif.key_brake_left) { ap.cif.brakeLeft_sw = 1; } if (keyCode == ap.cif.key_landing_gear_sw) { ap.cif.landing_gear_counter = 0.0D; if (ap.cif.landing_gear_sw == 1) { ap.cif.landing_gear_sw = -1; } else { ap.cif.landing_gear_sw = 1; } } if (keyCode == ap.cif.key_flap_down) { ap.cif.flap_sw = -1; } if (keyCode == ap.cif.key_flap_up) { ap.cif.flap_sw = 1; } if (keyCode == ap.cif.key_front) { ap.cif.view_direction = 1; } if (keyCode == ap.cif.key_front_left) { ap.cif.view_direction = 2; } if (keyCode == ap.cif.key_left) { ap.cif.view_direction = 3; } if (keyCode == ap.cif.key_rear_left) { ap.cif.view_direction = 4; } if (keyCode == ap.cif.key_rear) { ap.cif.view_direction = 5; } if (keyCode == ap.cif.key_rear_right) { ap.cif.view_direction = 6; } if (keyCode == ap.cif.key_right) { ap.cif.view_direction = 7; } if (keyCode == ap.cif.key_front_right) { ap.cif.view_direction = 8; } if (keyCode == ap.cif.key_upper) { ap.cif.view_upper = 1; } if (keyCode == ap.cif.key_padLock) { if (ap.cif.padLock_sw == 0) { ap.cif.padLock_sw = 1; } else { ap.cif.padLock_sw = 0; } } if (keyCode == ap.cif.key_padLock_next) { pobj.PadLockNext(ap); } if (keyCode == ap.cif.key_padLock_prev) { pobj.PadLockPrev(ap); } } if (simIF.mode == 1) { if (keyCode == simIF.key_record_output) { simIF.record_output_sw = 1; } if (keyCode == simIF.key_dispData) { if (simIF.dispDataSw == 0) { simIF.dispDataSw = 1; } else { simIF.dispDataSw = 0; } } for (int i = 0; i < simIF.key_locus_action.Length; i++) { if (keyCode == simIF.key_locus_action[i]) { simIF.locus_action_sw[i] = 1; } } if (keyCode == simIF.key_param_reset) { simIF.param_reset_sw = 1; } if (keyCode == simIF.key_data_foword) { simIF.data_foword_sw = 1; } if (keyCode == simIF.key_data_back) { simIF.data_back_sw = 1; } } }
//public virtual void Run() //{ // //while (thread == ILOG.J2CsMapping.Threading.ThreadWrapper.CurrentThread) // { // //Repaint(); // try // { // //Sleep(tp.ThreadPeriodMsec()); // } // catch (ThreadInterruptedException localInterruptedException) // { // } // } //} //public override void Start() //{ // if (thread == null) // { // thread = new ThreadWrapper(this); // thread.Start(); // } //} //public override void Stop() //{ // thread = null; //} public void Update(Graphics g) { if (simIF.changePlane == 1) { //g.DrawString("Now Loading...", 200, 250); System.Console.Out.WriteLine("################# 飛行機変更 ############################################"); System.Console.Out.WriteLine("飛行機番号=" + configMenu.selectedAirPlane); System.Console.Out.WriteLine("CODEBASE=" + codeBase); System.Console.Out.WriteLine("PATH=" + configMenu.apl.GetPath(configMenu.selectedAirPlane)); simIF.changePlane = 0; ap = new AirPlane(codeBase, configMenu.apl.GetPath(configMenu.selectedAirPlane)); ap.Set_pMotionLand(); InitPadlockList(); } if (simIF.changePSetting == 1) { configMenu.SetPSetting(tp); simIF.changePSetting = 0; } if (simIF.pause_sw == 0) { simIF.counter -= 1; if (simIF.counter <= 0) { for (int i = 0; i < tp.t_disp; i++) { ap.Update(tp.dt); if (ap.crash_point != -1) { Jp.Maker1.Util.Gui.Caption.SetCaption("POINT " + ap.crash_point + " TOUCH THE GROUND.", 4.0D); } tp.simT += tp.dt; tp.rec_counter += 1; if (tp.rec_counter >= tp.t_record) { recorder.Record(tp.simT, tp.dt, ap); tp.rec_counter = 0; } } if (simIF.slow_mode == 1) { simIF.counter = simIF.slow_count; } else { simIF.counter = 0; } } } if (simIF.mode == 0) { gd.CreateImage(myGC, ap, simIF, tp.dt); //myGC.SetColor(Java.Awt.Color.black); myGC.DrawRectangle(Pens.Black, (int)sX0, (int)sY0, (int)(sX1 - sX0 - 1.0D), (int)(sY1 - sY0 - 1.0D)); } else if (simIF.mode == 1) { if (simIF.locusMake == 1) { //g.SetColor(Java.Awt.Color.white); //g.FillRect((int)sX0, (int)sY0, (int)(sX1 - sX0 + 1.0D), (int)(sY1 - sY0 + 1.0D)); //g.SetColor(Java.Awt.Color.black); //g.DrawString("Now Drawing...", 280, 150); locusVierer = new LocusViewer(sX0, sY0, sX1, sY1, ap, recorder); simIF.locusMake = 0; } locusVierer.UpdateDispParam(simIF, tp.ThreadPeriod()); if (simIF.locusImageMake == 1) { //g.SetColor(Java.Awt.Color.white); //g.FillRect((int)sX0, (int)sY0, (int)(sX1 - sX0 + 1.0D), (int)(sY1 - sY0 + 1.0D)); //g.SetColor(Java.Awt.Color.black); //g.DrawString("Now Drawing...", 280, 150); locusVierer.DrawLocus(locusGC, 1); // myGC.DrawImage(LocusImage, 0, 0, this); simIF.locusImageMake = 0; } //myGC.DrawImage(LocusImage, 0, 0, this); if (simIF.Check_locus_action_sw() > 0) { // myGC.DrawImage(LocusImage, 0, 0, this); locusVierer.DrawLocus(myGC, 0); } locusVierer.DrawData(myGC, simIF); // myGC.SetColor(Java.Awt.Color.black); //myGC.DrawRect((int)sX0, (int)sY0, (int)(sX1 - sX0 - 1.0D), (int)(sY1 - sY0 - 1.0D)); } else if (simIF.mode == 2) { configMenu.Draw(myGC, "Ver.1.1 2003.11.04"); } tp.tsim_dt += tp.ThreadPeriod(); long t_end = (DateTime.Now.Ticks / 10000); if (simIF.pause_sw == 0) { //myGC.SetColor(gd.informationColor); myGC.DrawString("ΔT:" + DispFormat.DoubleFormat(tp.dt * 1000.0D, 3, 0), gd.stdFont, gd.interfaceColorBrush, 2, 11); //myGC.DrawString("T:" + Jp.Maker1.Sim.Tools.Tool.TimeStr3(tp.simT), 2, 22); //myGC.DrawString("T-ΣΔT:" + Jp.Maker1.Util.DispFormat.DoubleFormat((t_end - tp.tStart) / 1000.0D - tp.tsim_dt, 3, 3), 2, 33); //myGC.DrawString("TGT.FR:" + Jp.Maker1.Util.DispFormat.DoubleFormat(1.0D / tp.ThreadPeriod(), 3, 1), 2, 44); } Jp.Maker1.Util.Gui.Caption.Draw(myGC); Jp.Maker1.Util.Gui.Caption.Update(tp.ThreadPeriod()); //g.DrawImage(doubleBuffer, 0, 0, this); if (simIF.record_output_sw == 1) { simIF.record_output_sw = 0; recorder.Print("Ver.1.1 2003.11.04"); } }
public static void AirplaneMethRef(ref AirPlane ap) { Console.WriteLine(AirPlane.uPlaneCnt); }
public void Create(AirPlane airPlane) { _airPlaneRepository.Insert(airPlane); }
public float liveTime = 10.0f; //10 초 동안 살아있다. void Awake() { //보통 Awake 함수내에서 GetComponent 같은것을 쓴다. this.myPlane = this.GetComponent <AirPlane>(); }
public static void AirplaneMethValue(AirPlane ap) { var pl = new AirPlane("a40"); Console.WriteLine(AirPlane.uPlaneCnt); }
public Bearing3 Bearing2PilotView(AirPlane ap) { return(new Bearing3(RPosPilotView(ap))); }
public Vector3D RPosPilot(AirPlane ap) { Matrix44 mat = ap.pMotion.wom.MultMat(ap.plane.opm); return(wpos.MultMat(mat)); }
public double Dist(AirPlane ap) { return(ap.pMotion.wpos.Sub(wpos).Length()); }
public int Delete(AirPlane Entity) { return(this._IAirPlane.Delete(Entity)); }
internal void Calc_dynamics(int lr, ControlPlane cw, AirPlane ap, Vector3D dv, double k_q, double k_S) { Matrix44 ma = new Matrix44(); Matrix44 mtemp = new Matrix44(); Vector3D vtemp = new Vector3D(); fv.SetVec(0.0D, 0.0D, 0.0D); tv.SetVec(0.0D, 0.0D, 0.0D); ac = AirPlane.Get_point(ac_base, lr).Sub(ap.inp.cg); dvv = ap.pMotion.omega.CrsProd(ac); vd = ap.pMotion.vc.Add(dvv); vd = vd.Add(dv); v = vd.Length(); vd = vd.NmlVec().SclProd(v * k_q); v = vd.Length(); s2_dash = (s2 * k_S); m = (v / ap.atmos.a); q = (0.5D * v * v * ap.atmos.rho); Vector3D kdd = new Vector3D(); Vector3D idd = new Vector3D(); Vector3D jdd = new Vector3D(); if ((cw != null) && (cw.type == 2)) { ma.SetRyMat(cw.delta); mtemp.SetRzMat(cw.lamda_h); ma = ma.MultMat(mtemp); if (lr == 1) { mtemp.SetRxMat(-cw.gamma_h); } else { mtemp.SetRxMat(-cw.gamma_h); } ma = ma.MultMat(mtemp); idd = id.MultMat(ma); kdd = kd.MultMat(ma); } else { idd = new Vector3D(id); jdd = new Vector3D(jd); kdd = new Vector3D(kd); } mtemp.Set3ColVec(idd, jdd, kdd); vdw = vd.MultMat(mtemp); alpha = Jp.Maker1.Sim.Tools.Tool.CalcAlpha(vdw); beta = Jp.Maker1.Sim.Tools.Tool.CalcBeta(vdw); ar = wing.AspectRatio(beta); are = (ar * wing.K_ground_effect(beta, ap.pMotion.wpos.y)); lamda_dash = SweepbackAngle(wing.hv_arrangement, lr, beta); Calc_cla(); delta_cl_flap = 0.0D; delta_cd_flap = 0.0D; delta_cmac_flap = 0.0D; delta_alpha = 0.0D; k_a = 1.0D; if ((cw != null) && ((cw.type == 1) || (cw.type == 1))) { cw.beta_f = Flap.Beta_f(lr, wing.hv_arrangement, cw.lamda_h, beta); cw.delta_dash = Flap.Delta_dash(cw.delta, cw.beta_f); if (Math.Abs(cw.beta_f) < 1.570796326794897D) { delta_alpha = (cw.f_lamda1 * cw.delta_dash); delta_cmac_flap = cw.f_cmac; } else { delta_alpha = (cw.b_lamda1 * cw.delta_dash); delta_cmac_flap = cw.b_cmac; } k_a = Flap.K_cla(cw.delta_dash, cw.cf_c); delta_cl_flap = (k_a * cla * delta_alpha); delta_cmac_flap *= (alpha + delta_alpha - alpha0); } vtemp.SetVec(0.0D, 0.0D, -1.0D); ma.SetRyMat(-alpha); mtemp.SetRzMat(beta); ma = ma.MultMat(mtemp); mtemp.Set3RowVec(idd, jdd, kdd); ma = ma.MultMat(mtemp); lu = vtemp.MultMat(ma); du = vd.SclProd(-1.0D).NmlVec(); alpha += delta_alpha; cla *= k_a; Calc_cl_cd(); l = (q * cl * s2_dash); cdi = (cl * cl / (Math.PI * are * ew)); cd += cdi; cd += delta_cd_flap; d = (q * cd * s2_dash); lf = Dynamics.Force(l, lu); lt = Dynamics.Torque(ac, lf); df = Dynamics.Force(d, du); dt = Dynamics.Torque(ac, df); cmac = cmac0; cmac += delta_cmac_flap; mac = (q * s2_dash * cmac); Vector3D mt_0 = new Vector3D(0.0D, mac, 0.0D); fv = lf.Add(df); tv = lt.Add(dt).Add(mt_0); }
public int Update(AirPlane Entity) { return(this._IAirPlane.Update(Entity)); }
//비행기 사망신고 public void RemovePlane(AirPlane plane) { //지금 삭제 되는 AirPlane 의 Tag 명 string tagName = plane.gameObject.tag; //기존에 있는 Key 니? if (this.airplaneMap.ContainsKey(tagName)) { //기존키에서 삭제 this.airplaneMap[tagName].Remove(plane); } /* if (plane.gameObject.tag == "Alience") this.aliencePlaneList.Remove(plane); else if (plane.gameObject.tag == "Enemy") this.enemyPlaneList.Remove(plane);*/ }
public void KeyReleased(Keys keyCode, AirPlane ap, SimulatorInterface simIF) { if (keyCode == simIF.key_ctrl) { simIF.ctrl_sw = 0; } if ((simIF.mode == 0) && (simIF.pause_sw == 0)) { if ((keyCode == ap.cif.key_rudder_left) || (keyCode == ap.cif.key_rudder_right)) { ap.cif.rudder_sw = 0; } if ((keyCode == ap.cif.key_throttle_up) || (keyCode == ap.cif.key_throttle_down)) { ap.cif.throttle_sw = 0; } if ((keyCode == ap.cif.key_mixture_lean) || (keyCode == ap.cif.key_mixture_rich)) { ap.cif.mixture_sw = 0; } if ((keyCode == ap.cif.key_prop_pitch_high) || (keyCode == ap.cif.key_prop_pitch_low)) { ap.cif.prop_pitch_sw = 0; } if (keyCode == ap.cif.key_brake_right) { ap.cif.brakeRight_sw = -1; } if (keyCode == ap.cif.key_brake_left) { ap.cif.brakeLeft_sw = -1; } if ((keyCode == ap.cif.key_flap_down) || (keyCode == ap.cif.key_flap_up)) { ap.cif.flap_sw = 0; } if ((keyCode == ap.cif.key_front) || (keyCode == ap.cif.key_front_left) || (keyCode == ap.cif.key_left) || (keyCode == ap.cif.key_rear_left) || (keyCode == ap.cif.key_rear) || (keyCode == ap.cif.key_rear_right) || (keyCode == ap.cif.key_right) || (keyCode == ap.cif.key_front_right)) { ap.cif.view_direction = 0; } if (keyCode == ap.cif.key_upper) { ap.cif.view_upper = 0; } } if (simIF.mode == 1) { for (int i = 0; i < simIF.key_locus_action.Length; i++) { if (keyCode == simIF.key_locus_action[i]) { simIF.locus_action_sw[i] = 0; if (simIF.Check_locus_action_sw() == 0) { simIF.locusImageMake = 1; } else { simIF.locusImageMake = 0; } } } if (keyCode == simIF.key_data_foword) { simIF.data_foword_sw = 0; } if (keyCode == simIF.key_data_back) { simIF.data_back_sw = 0; } } }
public void Calc_pp(AirPlane ap, double dt) { Vector3D delta_v = new Vector3D(); double v0 = ap.pMotion.vc.Length(); int lr; for (lr = 0; lr < ap.htail[0].n_lr; lr++) { for (int k = 0; k < ap.n_powerPlant; k++) { PowerPlant pp = ap.powerPlant[k]; if (pp.engine_type == 1) { ReciprocatingEngine re = (ReciprocatingEngine)pp.engine; double pr_l = re.wash_line.LengthPerpendicular(ap.htail[0].wp[0, lr].ac); double v_dash2 = pr_k * Jp.Maker1.Sim.Tools.Tool.Hokan(re.diameter * pr_k_diameter_min / 2.0D, re.wash_v_dash, re.diameter * pr_k_diameter_max / 2.0D, 0.0D, pr_l); delta_v = re.wash_direction.SclProd(v_dash2); htail_dv[lr] = htail_dv[lr].Add(delta_v); } } } for (lr = 0; lr < ap.vtail[0].n_lr; lr++) { for (int k_0 = 0; k_0 < ap.n_powerPlant; k_0++) { PowerPlant pp_1 = ap.powerPlant[k_0]; if (pp_1.engine_type == 1) { ReciprocatingEngine re_2 = (ReciprocatingEngine)pp_1.engine; double pr_l_3 = re_2.wash_line.LengthPerpendicular(ap.vtail[0].wp[0, lr].ac); double v_dash2_4 = pr_k * Jp.Maker1.Sim.Tools.Tool.Hokan(re_2.diameter * pr_k_diameter_min / 2.0D, re_2.wash_v_dash, re_2.diameter * pr_k_diameter_max / 2.0D, 0.0D, pr_l_3); delta_v = re_2.wash_direction.SclProd(v_dash2_4); vtail_dv[lr] = vtail_dv[lr].Add(delta_v); } } } for (int i = 0; i < ap.n_fuselage; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.fuslage[i, lr].flag != 0) { for (int k_5 = 0; k_5 < ap.n_powerPlant; k_5++) { PowerPlant pp_6 = ap.powerPlant[k_5]; if (pp_6.engine_type == 1) { ReciprocatingEngine re_7 = (ReciprocatingEngine)pp_6.engine; double pr_l_8 = re_7.wash_line.LengthPerpendicular(ap.fuslage[i, lr].ac); double v_dash2_9 = pr_k * Jp.Maker1.Sim.Tools.Tool.Hokan(re_7.diameter * pr_k_diameter_min / 2.0D, re_7.wash_v_dash, re_7.diameter * pr_k_diameter_max / 2.0D, 0.0D, pr_l_8); vtail_dv[lr] = vtail_dv[lr].Add(delta_v); fuselage_dv[i, lr] = fuselage_dv[i, lr].Add(delta_v); } } } } } }
public void Update(AirPlane airPlane) { _airPlaneRepository.Update(airPlane); }
public void SaveAirplane(AirPlane a) { }
public float liveTime = 10.0f; //10 초 동안 살아있다. void Awake() { //보통 Awake 함수내에서 GetComponent 같은것을 쓴다. this.myPlane = this.GetComponent<AirPlane>(); }
public void Delete(AirPlane airPlane) { _airPlaneRepository.Delete(airPlane); }
public void DrawInterfase(Graphics g, AirPlane ap) { CockpitInterface cif = ap.cif; //g.SetColor(interfaceColor); // g.SetFont(stdFont); double elevcent = ap.elevator[0, 0].delta_max / (ap.elevator[0, 0].delta_max - ap.elevator[0, 0].delta_min); int stx = stick_center_x; int sty = stick_center_y - stick_y_width + (int)(stick_y_width * 2.0D * elevcent + 0.5D); // g.SetColor(interfaceColorD); //g.DrawLine(stx, sty - 7, stx, sty + 7); //g.DrawLine(stx - 7, sty, stx + 7, sty); g.DrawLine(interfaceColorDPen, stx, sty - 7, stx, sty + 7); g.DrawLine(interfaceColorDPen, stx - 7, sty, stx + 7, sty); //g.SetColor(interfaceColor); //g.DrawRect(stick_center_x - stick_x_width, stick_center_y - stick_y_width, stick_x_width * 2, stick_y_width * 2); g.DrawRectangle(interfaceColorPen, stick_center_x - stick_x_width, stick_center_y - stick_y_width, stick_x_width * 2, stick_y_width * 2); int x = (int)(cif.stick_pos_x * stick_x_width + 0.5D) + stick_center_x; int y = (int)(cif.stick_pos_y * stick_y_width + 0.5D) + stick_center_y; g.DrawLine(interfaceColorPen, x, y, stx, sty); //g.FillOval(x - 3, y - 3, 6, 6); g.FillEllipse(interfaceColorBrush, x - 3, y - 3, 6, 6); if (cif.stick_mode == 0) { g.DrawString("CLICK TO ACTIVATE STICK", stdFont, interfaceColorBrush, stick_center_x - 70, stick_center_y - stick_y_width + 12); g.DrawEllipse(interfaceColorPen, x - 5, y - 5, 10, 10); } else { g.DrawLine(interfaceColorPen, x - 7, y, x + 7, y); g.DrawLine(interfaceColorPen, x, y + 7, x, y - 7); } int x0 = rudder_center_x - rudder_x_witdh; int x1 = rudder_center_x + rudder_x_witdh; int y0 = rudder_center_y + (int)(rudder_y_width * cif.rudder_pos + 0.5D); int y1 = rudder_center_y - (int)(rudder_y_width * cif.rudder_pos + 0.5D); // g.SetColor(interfaceColorD); // g.DrawRect(x0 - 5, y0 - 5, 10, 10); // g.DrawRect(x1 - 5, y1 - 5, 10, 11); // g.DrawLine(x0, y0, x1, y1); y0 = rudder_center_y + (int)(rudder_y_width * cif.frudder_pos.output + 0.5D); y1 = rudder_center_y - (int)(rudder_y_width * cif.frudder_pos.output + 0.5D); //g.SetColor(interfaceColor); //g.DrawRect(x0 - 5, y0 - 5, 10, 10); //g.DrawRect(x1 - 5, y1 - 5, 10, 11); //g.DrawLine(x0, y0, x1, y1); x0 = throttle_x; y0 = throttle_y; double pos; for (pos = 0.1D; pos <= 0.9D; pos += 0.1D) { y = (int)(throttle_width * pos + 0.5D); // g.DrawLine(x0, y0 - y, x0 + 2, y0 - y); } y = (int)(throttle_width * 0.5D + 0.5D); // g.DrawLine(x0, y0 - y, x0 + 5, y0 - y); // g.DrawString("T", x0 + 2, y0 - throttle_width - 1); //g.DrawRect(x0, y0 - throttle_width, 10, throttle_width); y = (int)(throttle_width * cif.throttle_pos + 0.5D); // g.FillRect(x0 + 2, y0 - y, 7, y); //g.DrawString(Jp.Maker1.Util.DispFormat.DoubleFormat(cif.throttle_pos * 100.0D, 0) + "%", x0, y0 - throttle_width - 13); x0 = mixture_x; y0 = mixture_y; for (pos = 0.1D; pos <= 0.9D; pos += 0.1D) { y = (int)(throttle_width * pos + 0.5D); //g.DrawLine(x0, y0 - y, x0 + 2, y0 - y); } y = (int)(throttle_width * 0.5D + 0.5D); // g.DrawLine(x0, y0 - y, x0 + 5, y0 - y); // g.DrawString("M", x0 + 1, y0 - throttle_width - 1); // g.DrawRect(x0, y0 - mixture_width, 10, mixture_width); y = (int)(mixture_width * cif.mixture_pos + 0.5D); // g.FillRect(x0 + 2, y0 - y, 7, y); x0 = prop_pitch_x; y0 = prop_pitch_y; for (pos = 0.1D; pos <= 0.9D; pos += 0.1D) { y = (int)(throttle_width * pos + 0.5D); // g.DrawLine(x0, y0 - y, x0 + 2, y0 - y); } y = (int)(throttle_width * 0.5D + 0.5D); // g.DrawLine(x0, y0 - y, x0 + 5, y0 - y); // g.DrawString("P", x0 + 2, y0 - throttle_width - 1); // g.DrawRect(x0, y0 - prop_pitch_width, 10, prop_pitch_width); y = (int)(prop_pitch_width * cif.prop_pitch_pos + 0.5D); // g.FillRect(x0 + 2, y0 - y, 7, y); x0 = brake_right_x; y0 = brake_right_y; for (pos = 0.1D; pos <= 0.9D; pos += 0.1D) { y = (int)(throttle_width * pos + 0.5D); //g.DrawLine(x0, y0 - y, x0 + 2, y0 - y); } // g.DrawString("R", x0 + 2, y0 - throttle_width - 1); y = (int)(throttle_width * 0.5D + 0.5D); // g.DrawLine(x0, y0 - y, x0 + 5, y0 - y); // g.DrawRect(x0, y0 - brake_right_width, 10, brake_right_width); y = (int)(brake_right_width * cif.brakeRight_pos + 0.5D); // g.FillRect(x0 + 2, y0 - y, 7, y); x0 = brake_left_x; y0 = brake_left_y; for (pos = 0.1D; pos <= 0.9D; pos += 0.1D) { y = (int)(throttle_width * pos + 0.5D); // g.DrawLine(x0, y0 - y, x0 + 2, y0 - y); } //g.DrawString("W.BRK", x0 - 2, y0 - throttle_width - 13); // g.DrawString("L", x0 + 2, y0 - throttle_width - 1); y = (int)(throttle_width * 0.5D + 0.5D); // g.DrawLine(x0, y0 - y, x0 + 5, y0 - y); // g.DrawRect(x0, y0 - brake_left_width, 10, brake_left_width); y = (int)(brake_left_width * cif.brakeLeft_pos + 0.5D); // g.FillRect(x0 + 2, y0 - y, 7, y); }
public void Calc_w(AirPlane ap, double dt) { Vector3D v = new Vector3D(); Matrix44 ryMat = new Matrix44(); if ((ap.n_wing > 0) && (ap.n_htail > 0) && (ap.wing[0].n_wing_block > 0) && (ap.htail[0].n_wing_block > 0)) { double s_sum; double cl_sum = s_sum = 0.0D; wf_b_epsilon_htail = wf_epsilon_htail; int i; for (i = 0; i < ap.n_wing; i++) { for (int lr = 0; lr < ap.wing[i].n_lr; lr++) { for (int j = 0; j < ap.wing[i].n_wing_block; j++) { WingPlane wpi = ap.wing[i].wp[j, lr]; cl_sum += wpi.cl * wpi.s2; s_sum += wpi.s2; } } } for (i = 0; i < ap.n_aileron; i++) { for (int lr_0 = 0; lr_0 < 2; lr_0++) { if (ap.aileron[i, lr_0].type != 0) { WingPlane wpi_1 = ap.aileron[i, lr_0].baseWingBlock; cl_sum += ap.aileron[i, lr_0].d_cl * wpi_1.s2; s_sum += wpi_1.s2; } } } for (i = 0; i < ap.n_t_flap; i++) { for (int lr_2 = 0; lr_2 < 2; lr_2++) { if (ap.t_flap[i, lr_2].type != 0) { WingPlane wpi_3 = ap.t_flap[i, lr_2].baseWingBlock; cl_sum += ap.t_flap[i, lr_2].d_cl * wpi_3.s2; s_sum += wpi_3.s2; } } } for (i = 0; i < ap.n_l_flap; i++) { for (int lr_4 = 0; lr_4 < 2; lr_4++) { if (ap.l_flap[i, lr_4].type != 0) { WingPlane wpi_5 = ap.l_flap[i, lr_4].baseWingBlock; cl_sum += ap.l_flap[i, lr_4].d_cl * wpi_5.s2; s_sum += wpi_5.s2; } } } wing_cl = (cl_sum / s_sum); wing_ar = (ap.wing[0].AspectRatio(ap.pMotion.beta) * ap.wing[0].K_ground_effect(ap.pMotion.beta, ap.pMotion.wpos.y)); wf_epsilon = (2.0D * wing_cl / Math.PI / wing_ar); double alpha = Math.Abs(ap.pMotion.alpha / 2.0D - angle_t.GetValue()); double beta = Math.Abs(ap.pMotion.beta); wf_epsilon_htail = Jp.Maker1.Sim.Tools.Tool.Hokan2_2D(wf_theta1, wf_beta1, wf_epsilon, wf_theta2, wf_beta2, 0.0D, alpha, beta); wf_d_epsilon_htail = ((wf_epsilon_htail - wf_b_epsilon_htail) / dt); double v0 = ap.pMotion.vc.Length(); if (v0 > 5.0D) { v.SetVec(0.0D, 0.0D, -(v0 * wf_epsilon_htail - wf_d_epsilon_htail * lt / v0)); } else { v.SetVec(0.0D, 0.0D, -(v0 * wf_epsilon_htail)); } ryMat.SetRyMat(-(wf_epsilon_htail + ap.pMotion.alpha)); v = v.MultMat(ryMat); htail_dv[1] = htail_dv[1].Add(v); htail_dv[0] = htail_dv[0].Add(v); } }