Example #1
0
        public void PlaySound(string soundFileName)
        {
            if (string.IsNullOrEmpty(soundFileName))
            {
                return;
            }

            var path = string.Format("Sounds/{0}", soundFileName);

            GameUIScene.RunAction(SKAction.PlaySoundFileNamed(path, false));
        }
Example #2
0
        public void PlayMusic(string soundFileName)
        {
            if (soundFileName == null)
            {
                return;
            }

            if (GameUIScene.GetActionForKey(soundFileName) != null)
            {
                return;
            }

            string   path         = string.Format("Sounds/{0}", soundFileName);
            SKAction repeatAction = SKAction.RepeatActionForever(SKAction.PlaySoundFileNamed(path, true));

            GameUIScene.RunAction(repeatAction, soundFileName);
        }
Example #3
0
        public void SetGameState(GameState gameState)
        {
            // Ignore redundant state changes.
            if (CurrentGameState == gameState)
            {
                return;
            }

            // Change the UI system according to gameState.
            GameUIScene.SetGameState(gameState);

            // Only reset the level from a non paused mode.
            if (gameState == GameState.InGame && CurrentGameState != GameState.Paused)
            {
                GameLevel.ResetLevel();
            }

            CurrentGameState = gameState;

            // Based on the new game state... set the saturation value
            // that the techniques will use to render the scenekit view.
            if (CurrentGameState == GameState.PostGame)
            {
                SetPostGameFilters();
            }
            else if (CurrentGameState == GameState.Paused)
            {
                Sim.PlaySound("deposit.caf");
                SetPauseFilters();
            }
            else if (CurrentGameState == GameState.PreGame)
            {
                SetPregameFilters();
            }
            else
            {
                Sim.PlaySound("ack.caf");
                SetIngameFilters();
            }
        }