public void Update() { if (Input.GetMouseButtonDown(0) && !isMoving) { RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, planetLayerMask); if (hit.collider != null) { if (newPlanetIndex != int.Parse(hit.collider.gameObject.name)) { int tempPlanetIndex = int.Parse(hit.collider.gameObject.name); Planet p = planetGenerator.GetPlanet(tempPlanetIndex); if (MoveShip(p)) { p.SetVisited(); isMoving = true; orbitCenter = hit.transform.position; newPlanetIndex = tempPlanetIndex; } else { updateUI.MoveToPlanet(false); } } } } if (!planetGenerator.IsSpawning && !updateUI.Paused) { if (isMoving) { Fuel -= Time.deltaTime / 4; } else { Fuel -= Time.deltaTime / 12; } if (Fuel < 0) { Fuel = 0; } } }