// Update is called once per frame void Update() { if (canFly) { CPCS.UpdateFuel(lastFuelVolume); lastFuelVolume -= Time.deltaTime; if (lastFuelVolume <= 0.1f) { // Отключить игрока canFly = false; SpaceShipControl ssc = FindObjectOfType <SpaceShipControl>(); ssc.FreezeAll(); EndGame(endMessage_01); } } else { if (Input.GetKey(KeyCode.Return)) { ControlPanelCanvasScript cpcs = FindObjectOfType <ControlPanelCanvasScript>(); cpcs.CloseEndMessage(); } } }
public void TeleportProcess() { player.FreezeAll(); int ind = Random.Range(0, pointOfTeleport.Count); Vector3 suddenPoint = pointOfTeleport[ind].position; Quaternion suddenRotation = pointOfTeleport[ind].rotation; spawnVortex.transform.position = suddenPoint; spawnVortex.transform.rotation = suddenRotation; spawnVortex.gameObject.SetActive(true); spawn = spawnVortex.GetRespawn(); exit = spawnVortex.GetExit(); exitLine = exit.position - spawn.position; exitLine.Normalize(); player.transform.position = spawn.position; player.transform.LookAt(exit.position, exit.up); StartCoroutine(PlayerExitFlight()); }