void Update() { float theThrust = thrust; if (Input.GetKeyDown(KeyCode.K) && gameManager.playerLocation == locationType.Air) { gameManager.newLandingCode(); } if (Input.GetKeyDown(KeyCode.L) && gameManager.canLand && gameManager.spawnManager.spawnName != "none") { // print(gameManager.spawnName); //if (gameManager.spawnName == "none" || gameManager.spawnName == "") gameManager.spawnName = "StartingPoint"; switch (gameManager.playerLocation) { case locationType.Air: gameManager.playerLocation = locationType.Ground; gameManager.landPlayerShip(); break; case locationType.Space: gameManager.playerLocation = locationType.Air; //gameManager.spaceSpawn = "StartingPoint"; if (gameManager.sceneName == "none") { gameManager.sceneName = "Ground"; } SceneManager.LoadScene(gameManager.spawnManager.sceneName); break; } //Debug.Log(gameManager.playerLocation); gameManager.GetComponent <GameManager>()._SpawnPlayer();//"same map"); gameManager.updateTargets = true; } //&& landingControl if (Input.GetKeyDown(KeyCode.T) && gameManager.playerLocation != locationType.Space) { //print(gameManager.spawnName); gameManager.playerLocation = locationType.Space; //gameManager.spaceSpawn = "StartingPoint"; gameManager.spawnManager.spawnName = gameManager.spaceSpawn; //print(gameManager.sceneName); // if (gameManager.sceneName == "none" || gameManager.sceneName == "") // { gameManager.sceneName = "Space"; // } //gameManager.spawnName = gameManager.spaceSpawn; //gm.locate=GameManager.location_t.Ground; //gm.UpdateData=true; //gm.spawnIndex=0; //gm.spawnName=spawnName; SceneManager.LoadScene(gameManager.sceneName); //gameManager.SpawnPlayer("same map"); } if (playerControl) { if (generator.getCurrentEnergy(gameManager.characterManager.characterData) > 0) { thrust = Input.GetAxis("Vertical"); turn = Input.GetAxis("Horizontal") * turnSpeed; } //Debug.Log(string.Format("thrust {0} --- turn {1}", thrust, turn)); } if (thrust > 0F) { theThrust *= forwardThrust; if (!thrustGlowOn) { thrustGlowOn = !thrustGlowOn; BroadcastMessage("SetThrustGlow", thrustGlowOn, SendMessageOptions.DontRequireReceiver); } } else { theThrust *= backwardThrust; if (thrustGlowOn) { thrustGlowOn = !thrustGlowOn; BroadcastMessage("SetThrustGlow", thrustGlowOn, SendMessageOptions.DontRequireReceiver); } } GetComponent <Rigidbody>().AddRelativeTorque(Vector3.up * turn * Time.deltaTime); GetComponent <Rigidbody>().AddRelativeForce(forwardDirection * theThrust * Time.deltaTime); }