private void Update() { // Debug.Log("Target: " + (agent.destination == null ? "null" : agent.destination.ToString())); // Debug.Log("Agent stopped: " + agent.isStopped); // Debug.Log("Agent distance: " + agent.remainingDistance); if (agent.enabled && agent.remainingDistance < .5f && currentDestination == spawnPoint) { agent.isStopped = true; door.OperateDoor(); currentDestination = null; DialogueManager.Instance.ShowEndScreen(); Destroy(gameObject, 1f); } if (agent.enabled && agent.remainingDistance < .5f && currentDestination == sofaPoint) { Debug.Log("Reached sofa"); currentDestination = null; agent.isStopped = true; agent.enabled = false; StartCoroutine(JumpOnSofa()); // Jump on sofa } }