public void InitGame() { soundsController.PlaySound(SoundsController.Type.Click); initUI.SetActive(false); musicController.StartGame(); lifeTime = 0; starsCount = 0; timer.SetActive(true); Destroy(starsParent.gameObject); starsParent = (new GameObject("StarsParent")).transform; starsParent.parent = this.transform; stars.Clear(); player = Instantiate(playerPrefab, starsParent) as CharacterStarController; player.Init(Vector3.zero, startMass); player.onDead += PlayerDead; player.onEat += () => { soundsController.PlaySound(SoundsController.Type.Eat); starsCount++; }; cameraFollower.Init(player); }
public void Init(CharacterStarController player) { this.transform.position = player.transform.position + Vector3.back * 10; this.player = player; }