// Start is called before the first frame update
 void Start()
 {
     _rewardReceiver.ReceiveRewardAsObservable()
     .Subscribe(_ =>
     {
         _soundEffectPlayer.Play(SoundEffectType.GetRC);
         _particleSystem.Play();
     }).AddTo(this);
 }
 // Start is called before the first frame update
 void Start()
 {
     _workbench.UpdateRepairStateAsObservable()
     .Select(x => x.TotalRepairPower)
     .Pairwise()
     .Where(x => x.Previous.Value < x.Current.Value)
     .Subscribe(_ => _soundEffectPlayer.Play(SoundEffectType.Tap))
     .AddTo(this);
 }
    // Start is called before the first frame update
    void Start()
    {
        _workbench.ChangeCurrentRepairOrder()
        .Subscribe(ChangeCurrentOrder)
        .AddTo(this);

        prevButton.OnClickAsObservable()
        .Subscribe(_ =>
        {
            _soundEffectPlayer.Play(SoundEffectType.SelectButton);
            _workbench.RequestPreviewOrder();
        })
        .AddTo(this);
        nextButton.OnClickAsObservable()
        .Subscribe(_ =>
        {
            _soundEffectPlayer.Play(SoundEffectType.SelectButton);
            _workbench.RequestNextOrder();
        })
        .AddTo(this);
    }
Example #4
0
        public async Task Play(string id)
        {
            var found = await _library.Find(Context.Guild.Id, id).ToArrayAsync();

            if (found.Length == 0)
            {
                await TypingReplyAsync($"Cannot find any sound effects by search string `{id}`");

                return;
            }

            var sfx = found.Random(_random);

            var(result, finished) = await _player.Play(Context.User, sfx);

            switch (result)
            {
            case PlayResult.Enqueued:
                await Context.Message.AddReactionAsync(new Emoji(EmojiLookup.SpeakerLowVolume));

                await finished;
                await Context.Message.RemoveReactionAsync(new Emoji(EmojiLookup.SpeakerLowVolume), Context.Client.CurrentUser);

                return;

            case PlayResult.UserNotInVoice:
                await TypingReplyAsync("You are not in a voice channel!");

                return;

            case PlayResult.FileNotFound:
                await TypingReplyAsync("File not found.");

                return;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }