Ejemplo n.º 1
0
        private static void thrustOffSetPerModule(object sender, VOIDForEachPartModuleArgs args)
        {
            PartModule module = args.Data;

            float moduleThrust = 0;

            switch (module.moduleName)
            {
            case "ModuleEngines":
            case "ModuleEnginesFX":
                break;

            default:
                return;
            }

            if (!module.isEnabled)
            {
                return;
            }

            CenterOfThrustQuery cotQuery = new CenterOfThrustQuery();

            if (module is ModuleEngines)
            {
                ModuleEngines engineModule = module as ModuleEngines;

                moduleThrust = engineModule.finalThrust;

                engineModule.OnCenterOfThrustQuery(cotQuery);
            }
            else             // engine is ModuleEnginesFX
            {
                ModuleEnginesFX engineFXModule = module as ModuleEnginesFX;

                moduleThrust = engineFXModule.finalThrust;

                engineFXModule.OnCenterOfThrustQuery(cotQuery);
            }

            if (moduleThrust != 0d)
            {
                cotQuery.thrust = moduleThrust;
            }

            thrustPos += cotQuery.pos * cotQuery.thrust;
            thrustDir += cotQuery.dir * cotQuery.thrust;
            thrust    += cotQuery.thrust;
        }
 public void UpdateThrustInfo()
 {
     thrustInfo = new CenterOfThrustQuery();
     engine.OnCenterOfThrustQuery(thrustInfo);
     thrustInfo.dir.Normalize();
 }