void InputUpdate()
{
if (Input.GetKeyDown (KeyCode.Keypad8)) {
Time.timeScale *= 2f;
Time.timeScale = Mathf.Min (Time.timeScale, 8f);
}
if (Input.GetKeyDown (KeyCode.Keypad2)) {
Time.timeScale /= 2f;
Time.timeScale = Mathf.Max (Time.timeScale, 1/8f);
}
this.enginePow = 0f;
if (this.forwardVelocity < this.targetSpeed * 0.99f) {
this.enginePow = this.enginePowMax;
}
if (this.forwardVelocity > this.targetSpeed * 1.1f) {
this.enginePow = this.enginePowMin;
}
if (this.pilotMode == PilotState.Pilot) {
if (Input.GetKeyDown (KeyCode.W)) {
this.targetSpeed += 1f;
}
if (Input.GetKey (KeyCode.W)) {
this.speedInc += Time.deltaTime * 5f;
this.targetSpeed += this.speedInc * Time.deltaTime;
}
if (Input.GetKeyUp (KeyCode.W)) {
this.speedInc = 0f;
this.targetSpeed = Mathf.Floor (this.targetSpeed);
}
if (Input.GetKeyDown (KeyCode.S)) {
this.targetSpeed -= 1f;
}
if (Input.GetKey (KeyCode.S)) {
this.speedInc += Time.deltaTime * 5f;
this.targetSpeed -= this.speedInc * Time.deltaTime;
}
if (Input.GetKeyUp (KeyCode.S)) {
this.speedInc = 0f;
this.targetSpeed = Mathf.Floor (this.targetSpeed);
}
this.targetSpeed = Mathf.Max (this.targetSpeed, 0f);
this.targetSpeed = Mathf.Min (this.targetSpeed, this.maxSpeed);
}
else if (this.pilotMode == PilotState.AutoPilot) {
this.targetSpeed = this.maxSpeed;
if (this.SelectedPlanetDist < this.SelectedPlanet.radius * 10f) {
this.targetSpeed = this.maxSpeed / 2f;
}
this.SwitchModeTo (PilotState.OrbitAutoPilot);
}
else if (this.pilotMode == PilotState.OrbitAutoPilot) {
this.targetSpeed = Mathf.Sqrt (this.SelectedPlanet.Grav.mass / this.SelectedPlanetDist);
this.SwitchModeTo (PilotState.Orbit);
}
if (this.playerInput) {
if (Input.GetKeyDown (KeyCode.P)) {
if (this.pilotMode == PilotState.Pilot) {
this.SwitchModeTo (PilotState.AutoPilot);
}
else {
this.SwitchModeTo (PilotState.Pilot);
}
}
if (this.pilotMode == PilotState.Pilot) {
if (Input.GetKeyDown (KeyCode.R)) {
this.SelectedPlanetIndex = this.SelectedPlanetIndex + 1;
}
else if (Input.GetKeyDown (KeyCode.F)) {
this.SelectedPlanetIndex = this.SelectedPlanetIndex - 1;
}
}
}
}