Example #1
0
        public Butterfly(int row, int col)
        {
            View.Source = new BitmapImage(new Uri("/Images/Butterfly.png", UriKind.Relative));
            //_dieSound.Open(new Uri("",UriKind.Relative));
            Row = row;
            Col = col;
            DefaultDirectionIdx = 0;

            _moveInDirection = new Dictionary <Direction, Func <KeyValuePair <bool, bool> > >()
            {
                [Direction.Left]  = MoveLeft,
                [Direction.Down]  = MoveDown,
                [Direction.Right] = MoveRight,
                [Direction.Up]    = MoveUp
            };

            _directionsOrder = new[]
            {
                Direction.Left,
                Direction.Down,
                Direction.Right,
                Direction.Up
            };

            CurrentDirectionIndex = 0;

            DieSound.Open(new Uri($"{Directory.GetCurrentDirectory()}/Data/Sounds/butterflyDieSound.wav", UriKind.Absolute));
        }
Example #2
0
        private void UpdateSpriteAndSounds(bool on)
        {
            if (_entMan.TryGetComponent(Owner, out SpriteComponent? sprite))
            {
                switch (CurrentState)
                {
                case ExpendableLightState.Lit:
                    {
                        SoundSystem.Play(Filter.Pvs(Owner), LitSound.GetSound(), Owner);

                        if (IconStateLit != string.Empty)
                        {
                            sprite.LayerSetState(2, IconStateLit);
                            sprite.LayerSetShader(2, "shaded");
                        }

                        sprite.LayerSetVisible(1, true);
                        break;
                    }

                case ExpendableLightState.Fading:
                {
                    break;
                }

                default:
                case ExpendableLightState.Dead:
                {
                    if (DieSound != null)
                    {
                        SoundSystem.Play(Filter.Pvs(Owner), DieSound.GetSound(), Owner);
                    }

                    sprite.LayerSetState(0, IconStateSpent);
                    sprite.LayerSetShader(0, "shaded");
                    sprite.LayerSetVisible(1, false);
                    break;
                }
                }
            }

            if (_entMan.TryGetComponent(Owner, out ClothingComponent? clothing))
            {
                clothing.ClothingEquippedPrefix = on ? "Activated" : string.Empty;
            }
        }
 // Die사운드 관리는 4번째 오디오 소스가 한다
 public void DiePlay(DieSound die)
 {
     audios[3].Stop();
     audios[3].clip = dieClips[(int)die];
     audios[3].Play();
 }