public BadShooterViewModel(string name, double radius, IList<PlayerViewModel> players, ISoundEffect audioPlayer, IGunAimPhysics gunAimPhysics)
 {
     Name = name;
     Radius = radius;
     this.players = players;
     this.audioPlayer = audioPlayer;
     this.gunAimPhysics = gunAimPhysics;
     scores = players.ToDictionary(p => p.Key, p => 0);
     animationTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(10) };
     animationTimer.Tick += DispatcherTimerOnTick;
     gameTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
     gameTimer.Tick += CountDown;
 }
示例#2
0
文件: XNAAudio.cs 项目: drme/thw-ui
 public void PlaySound(ISoundEffect sound)
 {
     if (null != sound)
     {
         ((XNASoundEffect)sound).Play();
     }
 }
示例#3
0
        //protected IReset iReset;

        public GameScreenBase(Game game)
        {
            //iReset = game.Services.GetService(typeof(IReset)) as IReset;
            iHUD = game.Services.GetService(typeof(IHUD)) as IHUD;
            iPopUp = game.Services.GetService(typeof(IPopUpManager)) as IPopUpManager;
            World = new World(new Vector2(0, 30));
            iSoundEffect = game.Services.GetService(typeof(ISoundEffect)) as ISoundEffect;
            iScrollingBackground = game.Services.GetService(typeof(IScrollingBackground)) as IScrollingBackground;
            iVisualiser = game.Services.GetService(typeof(IVisualiser)) as IVisualiser;

        }
示例#4
0
 public void PlaySE(ISoundEffect se, Transform transform)
 {
     if (se.Synced)
     {
         MusicManager.Instance.SyncedCall((beat) => PlayImmediate(se, transform));
     }
     else
     {
         PlayImmediate(se, transform);
     }
 }
示例#5
0
        public Player(GameContext gameContext, IHealthComponent healthComponent, IComponent <IPlayer> inputComponent, IPlayerPhysicsComponent physicsComponent, IDrawableComponent <IPlayer> graphicsComponent, IProjectilesManager projectileManager)
        {
            _gameContext       = gameContext ?? throw new ArgumentNullException(nameof(gameContext));
            _inputComponent    = inputComponent ?? throw new ArgumentNullException(nameof(inputComponent));
            _healthComponent   = healthComponent ?? throw new ArgumentNullException(nameof(healthComponent));
            _physicsComponent  = physicsComponent ?? throw new ArgumentNullException(nameof(physicsComponent));
            _graphicsComponent = graphicsComponent ?? throw new ArgumentNullException(nameof(graphicsComponent));
            _projectileManager = projectileManager ?? throw new ArgumentNullException(nameof(projectileManager));

            _acceleratingSoundEffect    = _gameContext.GameAudio.CreateSoundEffect(_gameContext.AssetManager.GetSoundEffect(GameConstants.ThrusterConstants.Thruster1Constants.Audio.ThrustingSoundEffectName));
            _invulnerabilitySoundEffect = _gameContext.GameAudio.CreateSoundEffect(_gameContext.AssetManager.GetSoundEffect(GameConstants.PlayerConstants.Audio.InvulnerableSoundEffectName));

            _invulnerableStopwatch = new Stopwatch();
            _flashingStopwatch     = new Stopwatch();
        }
示例#6
0
 void PlayImmediate(ISoundEffect se, Transform transform)
 {
     if (!se.Exclusive && !se.Spacial)
     {
         UnSpacialSource.PlayOneShot(se.Clip, se.Volume);
         return;
     }
     if (se.Exclusive)
     {
         foreach (var s in sources)
         {
             if (s.soundEffect == se)
             {
                 s.Stop();
             }
         }
     }
     GetSESource().Play(se, transform);
 }
示例#7
0
        public async Task <(PlayResult, Task)> Play(IUser user, ISoundEffect sfx)
        {
            if (!_fs.File.Exists(sfx.Path))
            {
                return(PlayResult.FileNotFound, Task.CompletedTask);
            }

            if (user is not IVoiceState vs)
            {
                return(PlayResult.UserNotInVoice, Task.CompletedTask);
            }

            var q = await _queueCollection.Get(vs.VoiceChannel.Guild.Id);

            await q.VoicePlayer.Move(vs.VoiceChannel);

            var finishedTask = await q.Enqueue(sfx, new AudioFileReader(sfx.Path));

            return(PlayResult.Enqueued, finishedTask);
        }
示例#8
0
        public void Play()
        {
            if (false == this.missing)
            {
                if (null == this.soundEffect)
                {
                    if (null != this.engine.Audio)
                    {
                        this.soundEffect = this.engine.Audio.LoadSound(this.Name);
                    }
                }

                if (null == this.soundEffect)
                {
                    this.missing = true;
                }
                else
                {
                    this.engine.Audio.PlaySound(this.soundEffect);
                }
            }
        }
 public static void BreakingBlockSoundEffect()
 {
     breakingBlockSoundEffect = new BrickBreakingEffect();
     breakingBlockSoundEffect.Play();
 }
 public static void BlockBumpedEffect()
 {
     blockBumpedEffect = new BlockBumpEffect();
     blockBumpedEffect.Play();
 }
 public static void SuperMarioJumpEffect()
 {
     superMarioJumpEffect = new SuperMarioJumpEffect();
     superMarioJumpEffect.Play();
 }
 public static void StompEffect()
 {
     stompEffect = new StompEffect();
     stompEffect.Play();
 }
 public static void SmallMarioJumpEffect()
 {
     smallMarioJumpEffect = new SmallMarioJumpEffect();
     smallMarioJumpEffect.Play();
 }
示例#14
0
 public void StopMusic()
 {
     ActiveSong?.Stop();
     ActiveSong = null;
 }
 public static void GoombaHitEffect()
 {
     goombaHitEffect = new GoombaStompedEffect();
     goombaHitEffect.Play();
 }
 public static void FlagPoleEffect()
 {
     flagPoleEffect = new FlagPoleMovingEffect();
     flagPoleEffect.Play();
 }
 public static void EnemyFlippedEffect()
 {
     enemyFlipped = new EnemyFlippedEffect();
     enemyFlipped.Play();
 }
示例#18
0
 public GameSound(GameContext context, ISoundEffect effect)
 {
     Context = context;
     Effect  = effect;
 }
示例#19
0
        public void PlaySound(ISoundEffect sound)
        {
            var info = (SoundInfo)sound;

            info.SoundEffect.Play();
        }
 public static void CoinEffect()
 {
     coinEffect = new CoinEffect();
     coinEffect.Play();
 }
 public static void PacExtraLifeEffect()
 {
     pacExtraLifeEffect = new PacMarioExtraLifeEffect();
     pacExtraLifeEffect.Play();
 }
 public static void EatGhostEffect()
 {
     eatGhostEffect = new EatGhostEffect();
     eatGhostEffect.Play();
 }
示例#23
0
 public void Stop()
 {
     soundEffect = null;
     audioSource.Stop();
 }
 public static void FireBallThrowEffect()
 {
     fireBallThrowEffect = new FireballEffect();
     fireBallThrowEffect.Play();
 }
 public static void PacMarioChompEffect()
 {
     pacMarioChompEffect = new PacMarioChompEffect();
     pacMarioChompEffect.Play();
 }
 public static void GameOverEffect()
 {
     gameOverEffect = new GameOverEffect();
     gameOverEffect.Play();
 }
 public static void PowerPlayerUpEffect()
 {
     powerPlayerUpEffect = new PowerPlayerUpEffect();
     powerPlayerUpEffect.Play();
 }
 public static void OneUpEffect()
 {
     oneUpEffect = new OneUpEffect();
     oneUpEffect.Play();
 }
 public static void PowerUpAppearsEffect()
 {
     powerUpAppearsEffect = new PowerUpAppearsEffect();
     powerUpAppearsEffect.Play();
 }
示例#30
0
 public abstract ISoundEffect PlaySoundEffect(ISoundEffect isfx, bool repeat = false);
 public static void ShrinkingOrPipeEffect()
 {
     shrinkingOrPipeEffect = new ShrinkingOrPipeEffect();
     shrinkingOrPipeEffect.Play();
 }