Beispiel #1
0
        public void EnterState()
        {
            UnityEngine.Random.InitState(DateTime.Now.GetHashCode());

            // Layer 8 = Terrain. Layer 12 = Ball.
            Physics.IgnoreLayerCollision(8, 10);

            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);

            //ResetScene();

            switch (ThrowBallsConfiguration.Instance.Variation)
            {
            case ThrowBallsVariation.letters:
                audioManager.PlayDialogue(Db.LocalizationDataId.ThrowBalls_letters_Title, OnTitleVoiceOverDone);
                break;

            case ThrowBallsVariation.words:
                audioManager.PlayDialogue(Db.LocalizationDataId.ThrowBalls_words_Title, OnTitleVoiceOverDone);
                break;

            case ThrowBallsVariation.lettersinword:
                audioManager.PlayDialogue(Db.LocalizationDataId.ThrowBalls_letterinword_Title, OnTitleVoiceOverDone);
                break;

            default:
                break;
            }

            AudioManager.I.PlayMusic(Music.Theme10);
        }
Beispiel #2
0
        public GameState(ThrowBallsGame game)
        {
            this.game = game;

            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.lettersinword)
            {
                MAX_NUM_BALLS = 10;
            }

            instance = this;

            inputManager = ThrowBallsConfiguration.Instance.Context.GetInputManager();
            audioManager = game.Context.GetAudioManager();

            inputManager.Enabled = false;
        }
Beispiel #3
0
        protected override void OnInitialize(IGameContext context)
        {
            instance = this;

            GameState = new GameState(this);
        }