コード例 #1
0
 private void HandleInputForRocketOperation()
 {
     if (Input.GetKeyDown(KeyCode.E) && isNearRocket)
     {
         stats.displayText("Boaring rocket");
         GameController.instance.displayGuide("Rocket");
         thisBody.DetachBody();
         isInsideRocket = true;
         stats.displayText("Press SPACE to take off");
         stats.Rocket.GetComponent <PlayerRocketController>().enabled = true;
         stats.Rocket.GetComponent <PlayerRocketController>().ShowPlayerDummy(true);
         stats.Rocket.GetComponent <Rigidbody>().isKinematic = false;
         stats.SetCameraTo(GameController.WhosCamera.Rocket);
         gameObject.SetActive(false);
     }
 }
コード例 #2
0
 private void HandleInputForRocketOperation()
 {
     if (Input.GetKeyUp(KeyCode.Space) && stats.NearAPlanet)
     {
         if (isLanded)
         {
             rocketRB.isKinematic = false;
             thisBody.DetachBody();
             TookOffFXs();
             moveDir = new Vector3(0, 200f, 0).normalized;
             PropelRocket();
         }
         else if (!isLanded)
         {
             moveAmount = Vector3.zero;
             thisBody.AttachBody(stats.NearPlanet);
             isLanded = true;
             DisableFXs();
             stats.displayText("Press F to exit rocket");
         }
     }
     if (Input.GetKeyDown(KeyCode.F))
     {
         if (isLanded)
         {
             rocketRB.isKinematic = true;
             GameController.instance.displayText("Exiting rocket");
             GameController.instance.displayGuide("Player");
             player.SetActive(true);
             player.GetComponent <GravityBodyController>().AttachBody(stats.NearPlanet);
             ShowPlayerDummy(false);
             player.transform.position = playerLanding.position;
             player.transform.parent   = null;
             player.GetComponent <PlayerController>().enabled        = true;
             player.GetComponent <PlayerController>().isInsideRocket = false;
             stats.SetCameraTo(GameController.WhosCamera.Ken);
             this.enabled = false;
         }
     }
 }