Example #1
0
        public static IPlayerControl GetSoundControl(ISoundState soundState)
        {
            IPlayerControl playerControl;

            if(soundState is AmbientState)
            { playerControl = new AmbientPlayerControl(); }
            else if(soundState is IntervalSoundState)
            { playerControl = new IntervalSoundPlayerControl(); }
            else
            { throw new Exception(string.Format("Unable to bind state [{0}] to control", soundState.SoundTypeIdentifier)); }

            playerControl.PopulateFromState(soundState);
            return playerControl;
        }
        public void PopulateFromState(ISoundState soundState)
        {
            if (!(soundState is IntervalSoundState))
            { throw new Exception(string.Format("Unable to cast [{0}] to IntervalSoundState", soundState.GetType())); }

            var castState = (soundState as IntervalSoundState);

            ColumnPosition = castState.ColumnPosition;
            RowPosition = castState.RowPosition;
            Volume = castState.Volume;
            Interval = castState.Interval;
            LoadFile(castState.Filename);
        }
Example #3
0
        public void PopulateFromState(ISoundState soundState)
        {
            if(!(soundState is AmbientState))
            { throw new Exception(string.Format("Unable to cast [{0}] to AmbientState", soundState.GetType())); }

            var castState = (soundState as AmbientState);

            ColumnPosition = castState.ColumnPosition;
            RowPosition = castState.RowPosition;
            Volume = castState.Volume;
            isLooping = castState.isLooping;
            LoadFile(castState.Filename);
        }