public IEnumerator Initialise() { // Spawn the city, wait until it's generated if (cityPrefab) { City = Instantiate(cityPrefab, Vector3.zero, Quaternion.identity); } City.transform.SetParent(transform); yield return(new WaitUntil(() => CityGenerator.Generated)); // Spawn the player if (playerPrefab) { Player = Instantiate(playerPrefab, CityGenerator.NavMeshLocation(10, transform), Quaternion.identity); } // Set the camera target as the player mainCam.SetFollowTarget(Player.transform); mainCam.SetLookAtTarget(Player.transform); if (cityGen == null) { cityGen = FindObjectOfType <CityGenerator>(); } }
private void SpawnNextObjective(Objective objective) { switch (objective.goal) { case objectiveType.Puzzle: break; case objectiveType.Waypoint: objective.goalText = $"Go to {objective.waypointToReach.gameObject.name}"; break; case objectiveType.Collect: objective.goalText = $"Collect {objective.numToCollect} {objective.objectToCollect.gameObject.name}s"; objective.objectsToCollect = new GameObject[objective.numToCollect]; for (int i = 0; i < objective.numToCollect; i++) { GameObject collectObject = Instantiate(objective.objectToCollect, CityGenerator.NavMeshLocation(20, transform), Quaternion.identity, this.transform); objective.objectsToCollect[i] = collectObject; } break; case objectiveType.TalkToNPC: objective.goalText = $"Talk to {npc.gameObject.name}"; break; case objectiveType.ReturnToNPC: objective.goalText = $"Return to {npc.gameObject.name}"; break; default: break; } }