public void UpdateUnitSystem(UnitSystem unitSystem) { this.unitSystem = unitSystem; this.TextBox.Clear(); if (unitSystem != null) { string temperature = "Temperature: \t\t" + TemperatureConverter.GetUnitAsString(unitSystem.TemperatureUnit); string pressure = "Pressure: \t\t\t" + PressureConverter.GetUnitAsString(unitSystem.PressureUnit); string massFlowRate = "Mass Flow Rate: \t\t" + MassFlowRateConverter.GetUnitAsString(unitSystem.MassFlowRateUnit); string volumeFlowRate = "Volume Flow Rate: \t\t" + VolumeFlowRateConverter.GetUnitAsString(unitSystem.VolumeFlowRateUnit); string moistureContent = "Moisture Content: \t\t" + MoistureContentConverter.GetUnitAsString(unitSystem.MoistureContentUnit); string relativeHumidity = "Fraction: \t\t\t" + FractionConverter.GetUnitAsString(unitSystem.FractionUnit); string enthalpy = "Specific Energy: \t\t" + SpecificEnergyConverter.GetUnitAsString(unitSystem.SpecificEnergyUnit); string specificHeat = "Specific Heat: \t\t" + SpecificHeatConverter.GetUnitAsString(unitSystem.SpecificHeatUnit); string energy = "Energy: \t\t\t" + EnergyConverter.GetUnitAsString(unitSystem.EnergyUnit); string power = "Power: \t\t\t" + PowerConverter.GetUnitAsString(unitSystem.PowerUnit); string density = "Density: \t\t\t" + DensityConverter.GetUnitAsString(unitSystem.DensityUnit); string dynamicViscosity = "Dynamic Viscosity: \t\t" + DynamicViscosityConverter.GetUnitAsString(unitSystem.DynamicViscosityUnit); string kinematicViscosity = "Kinematic Viscosity: \t" + KinematicViscosityConverter.GetUnitAsString(unitSystem.KinematicViscosityUnit); string conductivity = "Thermal Conductivity: \t" + ThermalConductivityConverter.GetUnitAsString(unitSystem.ThermalConductivityUnit); string diffusivity = "Diffusivity: \t\t" + DiffusivityConverter.GetUnitAsString(unitSystem.DiffusivityUnit); string mass = "Mass: \t\t\t" + MassConverter.GetUnitAsString(unitSystem.MassUnit); string length = "Length: \t\t\t" + LengthConverter.GetUnitAsString(unitSystem.LengthUnit); string area = "Area: \t\t\t" + AreaConverter.GetUnitAsString(unitSystem.AreaUnit); string volume = "Volume: \t\t\t" + VolumeConverter.GetUnitAsString(unitSystem.VolumeUnit); string time = "Time: \t\t\t" + TimeConverter.GetUnitAsString(unitSystem.TimeUnit); this.TextBox.AppendText(temperature + "\r\n"); this.TextBox.AppendText(pressure + "\r\n"); this.TextBox.AppendText(massFlowRate + "\r\n"); this.TextBox.AppendText(volumeFlowRate + "\r\n"); this.TextBox.AppendText(moistureContent + "\r\n"); this.TextBox.AppendText(relativeHumidity + "\r\n"); this.TextBox.AppendText(enthalpy + "\r\n"); this.TextBox.AppendText(specificHeat + "\r\n"); this.TextBox.AppendText(energy + "\r\n"); this.TextBox.AppendText(power + "\r\n"); this.TextBox.AppendText(density + "\r\n"); this.TextBox.AppendText(dynamicViscosity + "\r\n"); this.TextBox.AppendText(kinematicViscosity + "\r\n"); this.TextBox.AppendText(conductivity + "\r\n"); this.TextBox.AppendText(diffusivity + "\r\n"); this.TextBox.AppendText(mass + "\r\n"); this.TextBox.AppendText(length + "\r\n"); this.TextBox.AppendText(area + "\r\n"); this.TextBox.AppendText(volume + "\r\n"); this.TextBox.AppendText(time); } }
private void Update() { bool pressedE = Input.GetKeyDown(KeyCode.E); if (pressedE) { RaycastHit hit; if (Physics.Raycast(mainCam.ScreenPointToRay(new Vector3(Screen.width * 0.5f, Screen.height * 0.5f, 0)), out hit, 2f)) { if (hit.transform.tag == "PowerConverter" && !isCarrying) { carriedObj = hit.transform.GetComponent <PowerConverter>(); carriedObj.Grab(holder.transform); isCarrying = true; } else if (hit.collider.tag == "Speeder" && isCarrying) { Transform slotObj = hit.collider.transform.parent.Find("Slots"); if (carriedObj.Place(slotObj)) { isCarrying = false; FindObjectOfType <GameManager>().Score(); } } else if (isCarrying) { carriedObj.Drop(mainCam); isCarrying = false; } } else if (isCarrying) { carriedObj.Drop(mainCam); isCarrying = false; } } if (health <= 0f || transform.position.y < -15f) { FindObjectOfType <GameManager>().PlayerDied(); GetComponent <Rigidbody>().freezeRotation = false; GetComponent <Rigidbody>().AddForce(deathVelocity); GetComponent <UnityStandardAssets.Characters.FirstPerson.RigidbodyFirstPersonController>().enabled = false; mainCam.GetComponentInChildren <BlasterShooting>().enabled = false; } }
public void Setup() { converter = new PowerConverter(); }
private void Convert(double value) { switch (SelectedOp) { case "Length": { LengthunitConverter unit = new LengthunitConverter(); Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString(); break; } case "Mass and Weight": { MassConverter unit = new MassConverter(); Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString(); break; } case "Power": { PowerConverter unit = new PowerConverter(); Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString(); break; } case "Pressure": { PressureConverter unit = new PressureConverter(); Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString(); break; } case "Energy": { EnergyConveter unit = new EnergyConveter(); Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString(); break; } case "Temperature": { TemperatureConverter unit = new TemperatureConverter(); Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString(); break; } case "Volume": { VolumeConverter unit = new VolumeConverter(); Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString(); break; } case "Angle": { AngleConverter unit = new AngleConverter(); Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString(); break; } case "Area": { AreaConverter unit = new AreaConverter(); Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString(); break; } case "Speed": { SpeedConverter unit = new SpeedConverter(); Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString(); break; } case "Time": { TimeunitsConverter unit = new TimeunitsConverter(); Result = unit.Convert(value, SelectedFrom, SelectedTo).ToString(); break; } } }