private void Awake() { IEngine jetEngine = new JetEngine(); IDriver humanDriver = new HumanDriver(); mPlayerBike.SetEngine(jetEngine); mPlayerBike.SetDriver(humanDriver); mPlayerBike.StartEngine(); IEngine nitroEngine = new NitroEngine(); IDriver androidDriver = new AndroidDriver(); mAndroidBike.SetEngine(nitroEngine); mAndroidBike.SetDriver(androidDriver); mAndroidBike.StartEngine(); IEngine rocketEngine = new RocketEngine(); IDriver alienDriver = new AlienDriver(); mAlienBike.SetEngine(rocketEngine); mAlienBike.SetDriver(alienDriver); mAlienBike.StartEngine(); IEngine steamEngine = new SteamEngine(); IDriver steampunkDriver = new SteampunkDriver(); mSteampunkBike.SetEngine(steamEngine); mSteampunkBike.SetDriver(steampunkDriver); mSteampunkBike.StartEngine(); }
// Use this for initialization void Start() { ui = GameObject.Find("Canvas").gameObject.GetComponent <UIController>(); rigidbody = GetComponent <Rigidbody>(); rE = GetComponent <RocketEngine>(); rE.GetMainController(this); }
public Tag GetEngineFuelTag() { RocketEngine mainEngine = GetMainEngine(); if ((Object)mainEngine != (Object)null) { return(mainEngine.fuelTag); } return(null); }
public float GetEngineEfficiency() { RocketEngine mainEngine = GetMainEngine(); if ((Object)mainEngine != (Object)null) { return(mainEngine.efficiency); } return(0f); }
void Start() { lineRenderer = gameObject.AddComponent <LineRenderer>(); lineRenderer.material = new Material(Shader.Find("Sprites/Default")); lineRenderer.SetColors(Color.yellow, Color.yellow); lineRenderer.SetWidth(0.2F, 0.2F); lineRenderer.useWorldSpace = false; RocketEngine forceAdded = GetComponent <RocketEngine>(); }
public override void DoPostConfigureComplete(GameObject go) { RocketEngine rocketEngine = go.AddOrGet <RocketEngine>(); rocketEngine.fuelTag = ElementLoader.FindElementByHash(SimHashes.Petroleum).tag; rocketEngine.efficiency = ROCKETRY.ENGINE_EFFICIENCY.MEDIUM; rocketEngine.explosionEffectHash = SpawnFXHashes.MeteorImpactDust; EntityTemplates.ExtendBuildingToRocketModule(go); RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_petroleum_engine_bg_kanim")); }
public void AddBody(GameObject gameObject, float physToWorldFactor) { if (numBodies + 1 >= arraySize) { GrowArrays(GROW_ARRAY); } bodies[numBodies] = gameObject; NBody nbody = bodies[numBodies].GetComponent <NBody>(); nbody.engineRef = new GravityEngine.EngineRef(GravityEngine.BodyType.MASSLESS, numBodies); // check for engine RocketEngine rocket = bodies[numBodies].GetComponent <RocketEngine>(); if (rocket != null) { rockets[numBodies] = rocket; #pragma warning disable 162 // disable unreachable code warning if (GravityEngine.DEBUG) { Debug.Log("Added rocket engine for " + gameObject); } #pragma warning restore 162 } Vector3 physicsPosition = gameObject.transform.position / physToWorldFactor; r[numBodies, 0] = physicsPosition.x; r[numBodies, 1] = physicsPosition.y; r[numBodies, 2] = physicsPosition.z; v[numBodies, 0] = nbody.vel_phys.x; v[numBodies, 1] = nbody.vel_phys.y; v[numBodies, 2] = nbody.vel_phys.z; info[numBodies] = 0; for (int childNum = 0; childNum < nbody.transform.childCount; childNum++) { Trajectory trajectory = nbody.transform.GetChild(childNum).GetComponent <Trajectory>(); if (trajectory != null) { trajectories[numBodies] = trajectory; break; } } #pragma warning disable 162 // disable unreachable code warning if (GravityEngine.DEBUG) { Debug.Log(string.Format("Added {0} at phys=({1} {2} {3})", gameObject.name, r[numBodies, 0], r[numBodies, 1], r[numBodies, 2])); } #pragma warning restore 162 numBodies++; }
private void Start() { _rocket = GameObject.FindGameObjectWithTag("Rocket"); if (UnitOfWork.PointNumber != "1") { return; } Time.timeScale = 0; _rocketEngine = _rocket.AddComponent <RocketEngine>(); _rocketEngine.EnginePosition = _enginePosition; _rocketEngine.enabled = false; }
public RocketEngine GetMainEngine() { RocketEngine rocketEngine = null; foreach (GameObject item in AttachableBuilding.GetAttachedNetwork(commandModule.GetComponent <AttachableBuilding>())) { rocketEngine = item.GetComponent <RocketEngine>(); if ((Object)rocketEngine != (Object)null && rocketEngine.mainEngine) { return(rocketEngine); } } return(rocketEngine); }
public override void DoPostConfigureComplete(GameObject go) { RocketEngine rocketEngine = go.AddOrGet <RocketEngine>(); rocketEngine.fuelTag = ElementLoader.FindElementByHash(SimHashes.LiquidHydrogen).tag; rocketEngine.efficiency = ROCKETRY.ENGINE_EFFICIENCY.STRONG; rocketEngine.explosionEffectHash = SpawnFXHashes.MeteorImpactDust; rocketEngine.exhaustElement = SimHashes.Steam; rocketEngine.exhaustTemperature = 2000f; EntityTemplates.ExtendBuildingToRocketModule(go); RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_hydrogen_engine_bg_kanim")); }
public float GetTotalThrust() { float num = 0f; float totalFuel = GetTotalFuel(false); float totalOxidizer = GetTotalOxidizer(false); float averageOxidizerEfficiency = GetAverageOxidizerEfficiency(); RocketEngine mainEngine = GetMainEngine(); if ((Object)mainEngine == (Object)null) { return(0f); } num = ((!mainEngine.requireOxidizer) ? (totalFuel * mainEngine.efficiency) : (Mathf.Min(totalFuel, totalOxidizer) * (mainEngine.efficiency * (averageOxidizerEfficiency / 100f)))); return(num + GetBoosterThrust()); }
public RocketEngineXna(PlanesGame game, RocketEngine rocketEngine, CoordinatesTransformer coordinatesTransformer) : base(game, rocketEngine, coordinatesTransformer) { m_workSoundEffect = game.GameManager.GameWorldXna.SoundManager.CreateFadeInOutSoundEffect("engine_work", TimeSpan.FromSeconds(0.4), TimeSpan.FromSeconds(0.1)); m_particlesEmitter = new AsymmetricParticlesEmitter(game.GameManager.GameWorldXna) { LongitualPositionDeviationRadius = 2, TransversePositionDeviationRadius = 0.4, LongitualVelocityDeviationRadius = 0.1, TransverseVelocityDeviationRadius = 0.02, AlphaVelocityDeviationFactor = 0.3 }; }
public void FillTank() { RocketEngine rocketEngine = null; foreach (GameObject item in AttachableBuilding.GetAttachedNetwork(GetComponent <AttachableBuilding>())) { rocketEngine = item.GetComponent <RocketEngine>(); if ((Object)rocketEngine != (Object)null && rocketEngine.mainEngine) { break; } } if ((Object)rocketEngine != (Object)null) { AddLiquid(ElementLoader.GetElementID(rocketEngine.fuelTag), targetFillMass - MassStored(), ElementLoader.GetElement(rocketEngine.fuelTag).defaultValues.temperature, 0, 0, false, true); } else { Debug.LogWarning("Fuel tank couldn't find rocket engine"); } }
// Use this for initialization void Start() { GravityEngine ge = GravityEngine.Instance(); time.text = string.Format(time_format, ge.GetPhysicalTime(), ge.GetTimeZoom()); Vector3 pos = ship.initialPos; position.text = string.Format(pos_format, pos.x, pos.y, pos.z); velocity.text = string.Format(vel_format, 0f, 0f, 0f); RocketEngine rocketEngine = ship.GetComponent <RocketEngine>(); if (rocketEngine == null) { Debug.LogError("Need a rocket component"); } fuelText.text = string.Format(fuel_format, rocketEngine.GetFuel(ge.GetPhysicalTime())); attitude.text = string.Format(attitude_format, 0f, 0f, 0f); // assume earth at (0,0,0) initial_altitude = Vector3.Magnitude(ship.transform.position); altitude.text = string.Format(altitude_format, 0f); }
// Use this for initialization void Awake() { rocketEngine = GetComponent <RocketEngine> (); }