public void EnterState() { Random.InitState(DateTime.Now.GetHashCode()); // Layer 8 = Terrain. Layer 12 = Ball. Physics.IgnoreLayerCollision(8, 10); // Layer 16 = Slingshot; Layer 10 = Player (Antura). Physics.IgnoreLayerCollision(16, 10); // Layer 16 = Slingshot; Layer 12 = Ball. Physics.IgnoreLayerCollision(16, 12); letterSpawner = new LetterSpawner(); foreach (Collider collider in ThrowBallsGame.instance.environment.GetComponentsInChildren <Collider>()) { collider.enabled = false; } letterPool = new GameObject[NUM_LETTERS_IN_POOL]; letterControllers = new LetterController[NUM_LETTERS_IN_POOL]; for (int i = 0; i < letterPool.Length; i++) { GameObject letter = ThrowBallsGame.Instantiate(game.letterWithPropsPrefab).GetComponent <LetterWithPropsController>().letter; LetterController letterController = letter.GetComponent <LetterController>(); letterPool[i] = letter; letterControllers[i] = letterController; letter.SetActive(false); } ThrowBallsGame.instance.letterWithPropsPrefab.SetActive(false); BallController.instance.Reset(); Catapult.instance.DisableCollider(); BallController.instance.Disable(); SlingshotController.instance.Disable(); AnturaController.instance.Disable(); ArrowHeadController.instance.Disable(); ArrowBodyController.instance.Disable(); AudioManager.I.PlayMusic(Music.Theme10); SlingshotController.instance.Enable(); GameObject poof = UnityEngine.Object.Instantiate(ThrowBallsGame.instance.poofPrefab, SlingshotController.instance.transform.position + new Vector3(0f, -5f, -2f), Quaternion.identity); UnityEngine.Object.Destroy(poof, 10); ThrowBallsConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.Poof); game.PlayIntro(OnIntroVoiceOverDone); }
public void EnterState() { Random.InitState(DateTime.Now.GetHashCode()); // Layer 8 = Terrain. Layer 12 = Ball. Physics.IgnoreLayerCollision(8, 10); // Layer 16 = Slingshot; Layer 10 = Player (Antura). Physics.IgnoreLayerCollision(16, 10); // Layer 16 = Slingshot; Layer 12 = Ball. Physics.IgnoreLayerCollision(16, 12); letterSpawner = new LetterSpawner(); foreach (Collider collider in ThrowBallsGame.instance.environment.GetComponentsInChildren <Collider>()) { collider.enabled = false; } letterPool = new GameObject[NUM_LETTERS_IN_POOL]; letterControllers = new LetterController[NUM_LETTERS_IN_POOL]; for (int i = 0; i < letterPool.Length; i++) { GameObject letter = ThrowBallsGame.Instantiate(game.letterWithPropsPrefab).GetComponent <LetterWithPropsController>().letter; LetterController letterController = letter.GetComponent <LetterController>(); letterPool[i] = letter; letterControllers[i] = letterController; letter.SetActive(false); } ThrowBallsGame.instance.letterWithPropsPrefab.SetActive(false); audioManager.PlayDialogue(ThrowBallsConfiguration.Instance.TitleLocalizationId, OnTitleVoiceOverDone); AudioManager.I.PlayMusic(Music.Theme10); BallController.instance.Reset(); Catapult.instance.DisableCollider(); BallController.instance.Disable(); SlingshotController.instance.Disable(); AnturaController.instance.Disable(); ArrowHeadController.instance.Disable(); ArrowBodyController.instance.Disable(); }
public LetterSpawner() { instance = this; }