void Update() { if (landGenerator == null) { landGenerator = new LandGenerator(config); } landGenerator.Update(); if (objectSpawner == null) { objectSpawner = new ObjectSpawner(config); } objectSpawner.Update(); if (playerPhysics == null) { playerPhysics = new PlayerPhysics(playerObject, config); } playerPhysics.Update(); if (cameraFollowPlayer == null) { cameraFollowPlayer = new CameraFollowPlayer(() => playerObject.transform, () => Camera.main.transform, config); } cameraFollowPlayer.Update(); }
public void StartPlaying() { player = GameObject.Instantiate(playerPrefab, Vector3.zero, Quaternion.identity).GetComponent <Player>(); currentState = GameState.PLAYING; stateStartTime = Time.time; ShowPlayUI(); followCamera.SetTarget(player.gameObject); followCamera.Update(); enemySpawner.player = player; gameOver.SetActive(false); enemySpawner.Reset(); }