Пример #1
0
        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);
        }
Пример #2
0
        public GameState(ThrowBallsGame game)
        {
            this.game = game;

            instance = this;

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

            inputManager.Enabled = false;

            currentLettersForLettersInWord = new List <ILivingLetterData>();

            flashedLettersInLiWVariation = new List <LL_LetterData>();
        }
Пример #3
0
        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();
        }
Пример #4
0
        public GameState(ThrowBallsGame game)
        {
            this.game = game;

            instance = this;

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

            inputManager.Enabled = false;

            currentLettersForLettersInWord = new List <ILivingLetterData>();

            // Configure num balls:
            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.BuildWord)
            {
                MAX_NUM_BALLS = 10;
            }
            else
            {
                var difficulty = game.Difficulty;

                if (difficulty <= ThrowBallsGame.ThrowBallsDifficulty.Normal)
                {
                    MAX_NUM_BALLS = 5;
                }
                else if (difficulty == ThrowBallsGame.ThrowBallsDifficulty.Hard)
                {
                    MAX_NUM_BALLS = 4;
                }
                else
                {
                    MAX_NUM_BALLS = 3;
                }
            }

            flashedLettersInLiWVariation = new List <LL_LetterData>();
        }
Пример #5
0
 protected override void OnInitialize(IGameContext context)
 {
     instance = this;
     SetDifficulty();
     GameState = new GameState(this);
 }