// Update is called once per frame void Update() { if (!gameOver) { timeSinceLastDay += Time.deltaTime * speedUI.GetSpeed(); int daysPassed = 0; while (timeSinceLastDay > timePerDay) { daysPassed++; currentDay++; timeSinceLastDay -= timePerDay; } if (daysPassed > 0) { onDayChanged(daysPassed); } } }
private void UpdatePosition() { if (Vector3.Distance(transform.position, target) < stoppingDistance) { onReachedTarget(); moving = false; } else { Vector3 direction = (target - transform.position).normalized; transform.position = transform.position + (direction * (movementSpeed * (Time.deltaTime * speedUI.GetSpeed()))); } }
private void CheckReachedTarget() { if (Vector3.Distance(transform.position, destinationSystem.transform.position) < stoppingDistance) { onReachedSystem(destinationSystem); SetLocation(destinationSystem); } else { if (internalMovementOnly && destinationSystem.GetEmpire() && destinationSystem.GetEmpire() != currentEmpire) { destinationSystem = currentRoute.GetDestination(destinationSystem); path.Clear(); systemTarget = destinationSystem; } Vector3 direction = (destinationSystem.transform.position - transform.position).normalized; transform.position = transform.position + (direction * (movementSpeed * (Time.deltaTime * speedUI.GetSpeed()))); } }