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