Well what I'm trying is to convert the java to c#
I've written a parser that just converts the bits I want to support, it's not 100% so it allows you to edit the result before it is compiled.
This is a working converted script.
using System;
using System.Collections.Generic;
using System.Text;
using IL2Modder.IL2;
public class B26
:AircraftInterface
{
List<IL2Modder.IL2.AircraftActions>actions = new List<IL2Modder.IL2.AircraftActions>();
private void SetAngles(String name, float t0, float t1, float t2)
{
IL2Modder.IL2.AircraftActions a = new IL2Modder.IL2.AircraftActions();
a.name = name;
a.y = t0;
a.p = t1;
a.r = t2;
a.type = 0;
actions.Add(a);
}
private void SetVisible(String name, bool value)
{
IL2Modder.IL2.AircraftActions a = new IL2Modder.IL2.AircraftActions();
a.name = name;
a.type = 1;
a.visible = value;
actions.Add(a);
}
public void update()
{
actions.Clear();
}
public List<IL2Modder.IL2.AircraftActions> GetResults()
{
return actions;
}
public B26()
{
kl = 1.0F;
kr = 1.0F;
kc = 1.0F;
}
private float[] anglesc7 = new float[] { 0.0F, -6.5F, -13.5F, -24.5F, -32.5F, -39.75F, -47.0F, -54.75F,
-62.5F, -69.75F, -83.5F };
private float[] anglesc6 = new float[] { 0.0F, -20.5F, -39.5F, -57.25F, -70.0F, -79.75F, -87.5F, -92.75F,
-95.0F, -94.0F, -85.0F };
private float kangle0 = 0.0F;
private float kangle1 = 0.0F;
private float floatindex(float f, float[] fs)
{
int i = (int)f;
if (i >= fs.GetLength(0) - 1) {
return fs[(fs.GetLength(0) - 1)];
}
if (i < 0) {
return fs[0];
}
if (i == 0)
{
if (f > 0.0F) {
return fs[0] + f * (fs[1] - fs[0]);
}
return fs[0];
}
return fs[i] + f % i * (fs[(i + 1)] - fs[i]);
}
public void moveGear(float f)
{
moveGear("", f);
}
public void moveGear(String h, float f)
{
SetAngles("GearC2_D0", 0.0F, 109.0F * f, 0.0F);
SetAngles("GearC6_D0", 0.0F, floatindex(Aircraft.cvt(f, 0.0F, 1.0F, 0.0F, 10.0F), anglesc6), 0.0F);
SetAngles("GearC4_D0", 0.0F, Aircraft.cvt(f, 0.0F, 0.1F, 0.0F, -95.0F), 0.0F);
SetAngles("GearC7_D0", 0.0F, floatindex(Aircraft.cvt(f, 0.0F, 1.0F, 0.0F, 10.0F), anglesc7), 0.0F);
SetAngles("L", 0.0F, Aircraft.cvt(f, 0.0F, 0.1F, 0.0F, -95.0F), 0.0F);
SetAngles("GearL2_D0", 0.0F, 0.0F, -89.5F * f);
SetAngles("GearL4_D0", 0.0F, Aircraft.cvt(f, 0.01F, 0.1F, 0.0F, -50.0F), 0.0F);
SetAngles("GearL5_D0", 0.0F, Aircraft.cvt(f, 0.01F, 0.1F, 0.0F, 57.0F), 0.0F);
SetAngles("GearR2_D0", 0.0F, 0.0F, -89.5F * f);
SetAngles("GearR4_D0", 0.0F, Aircraft.cvt(f, 0.01F, 0.1F, 0.0F, -57.0F), 0.0F);
SetAngles("GearR5_D0", 0.0F, Aircraft.cvt(f, 0.01F, 0.1F, 0.0F, 50.0F), 0.0F);
}
public void moveWheelSink()
{
}
public void moveRudder(float f)
{
SetAngles("GearC31_D0", -20.0F * f, 0.0F, 0.0F);
}
public void doMurderPilot(int i)
{
switch (i)
{
case 0:
SetVisible("Pilot1_D0", false);
SetVisible("HMask1_D0", false);
SetVisible("Pilot1_D1", true);
SetVisible("Head1_D0", false);
break;
case 1:
SetVisible("Pilot2_D0", false);
SetVisible("HMask2_D0", false);
SetVisible("Pilot2_D1", true);
break;
case 2:
SetVisible("Pilot3_D0", false);
SetVisible("HMask3_D0", false);
SetVisible("Pilot3_D1", true);
break;
case 3:
SetVisible("Pilot4_D0", false);
SetVisible("HMask4_D0", false);
SetVisible("Pilot4_D1", true);
break;
case 4:
SetVisible("Pilot5_D0", false);
SetVisible("HMask5_D0", false);
SetVisible("Pilot5_D1", true);
break;
case 5:
SetVisible("Pilot6_D0", false);
SetVisible("HMask6_D0", false);
SetVisible("Pilot6_D1", true);
break;
}
}
public void moveBayDoor(float f)
{
SetAngles("Bay1_D0", 0.0F, -110.0F * f, 0.0F);
SetAngles("Bay3_D0", 0.0F, 110.0F * f, 0.0F);
SetAngles("Bay2_D0", 0.0F, 110.0F * f, 0.0F);
SetAngles("Bay4_D0", 0.0F, -110.0F * f, 0.0F);
}
private float kl = 1.0F;
private float kr = 1.0F;
private float kc = 1.0F;
}
I can use this to animate the B26.