Esempio n. 1
0
        public void Update()
        {
            this.width  = game.width;
            this.height = game.height;

            if (_startButton.HitTestPoint(Input.mouseX, Input.mouseY))
            {
                _startButton.texture.Load("HUD/start selected.png");
            }
            else
            {
                _startButton.texture.Load("HUD/start.png");
            }


            if (_quitButton.HitTestPoint(Input.mouseX, Input.mouseY))
            {
                _quitButton.texture.Load("HUD/quit selected.png");
            }
            else
            {
                _quitButton.texture.Load("HUD/quit.png");
            }

            if (_infoButton.HitTestPoint(Input.mouseX, Input.mouseY))
            {
                _infoButton.texture.Load("HUD/info selected.png");
            }
            else
            {
                _infoButton.texture.Load("HUD/info.png");
            }

            if (Input.GetMouseButtonDown(0))
            {
                if (_startButton.HitTestPoint(Input.mouseX, Input.mouseY))
                {
                    StartGame();
                }
                if (_quitButton.HitTestPoint(Input.mouseX, Input.mouseY))
                {
                    game.Destroy();
                }
                if (_infoButton.HitTestPoint(Input.mouseX, Input.mouseY))
                {
                    InfoScreen info = new InfoScreen(_mygame);
                    game.AddChild(info);

                    _backgroundChanel.Stop();
                    _backgroundMusic  = null;
                    _backgroundChanel = null;
                    this.Destroy();
                }
            }
        }
Esempio n. 2
0
        public void PlayMusic(int index, float vol = 0.07f)
        {
            if (_currentMusicChannel != null && _currentMusicChannel.IsPlaying)
            {
                _currentMusicChannel.Stop();
            }

            index = Mathf.Abs(index % _musics.Length);

            _currentMusicChannel = _musics[index].Play(false, 0, vol);
        }
 void StopMusicChannel(SoundChannel channel)
 {
     if (channel != null && channel.IsPlaying)
     {
         channel.Stop();
     }
 }
Esempio n. 4
0
 private void StartGame()
 {
     _mygame.generateLevel();
     _backgroundChanel.Stop();
     _backgroundMusic  = null;
     _backgroundChanel = null;
     this.Destroy();
 }
Esempio n. 5
0
 void RemoveSponge()
 {
     if (spongeOnScreen == true)
     {
         spongeClean.Stop();
         RemoveChild(sponge);
         spongeOnScreen = false;
     }
 }
Esempio n. 6
0
 void RemoveShop()
 {
     if (isShopDisplayed == true)
     {
         RemoveChild(shop);
         openShopSoundChannel.Stop();
         shop.visible    = false;
         isShopDisplayed = false;
     }
 }
        void StopAllFxs()
        {
            if (_currentFxChannel == null)
            {
                return;
            }

            if (_currentFxChannel.IsPlaying || _currentFxChannel.IsPaused)
            {
                _currentFxChannel?.Stop();
            }
        }
        public void PlayMusic(string musicKey, float vol = 0.07f)
        {
            if (!_musicsLevelMap.ContainsKey(musicKey))
            {
                return;
            }

            _lastMusic    = (string.IsNullOrWhiteSpace(_currentMusic)) ? musicKey : _currentMusic;
            _currentMusic = musicKey;

            if (_currentMusicChannel != null && _currentMusicChannel.IsPlaying)
            {
                _currentMusicChannel.Stop();
            }

            uint nextChannel = GetNextFreeChannel();

            _currentChannelId = nextChannel;

            _sfxChannels[nextChannel] = _musicsLevelMap[musicKey].Play(false, nextChannel, vol);
            _currentMusicChannel      = _sfxChannels[nextChannel];
        }
 public void StopCurrentFxLoop()
 {
     _currentLoopFxChannel?.Stop();
 }
Esempio n. 10
0
 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 //                                                                                                                        stopMusic()
 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 void stopMusic()
 {
     _musicChannel.Stop();
 }