StopMusic() public method

public StopMusic ( ) : void
return void
Example #1
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("GameController.cs");

        // Load the current level
        _dataController  = SaveDataController.GetInstance();
        _currentLevelNum = _dataController.LoadData().CurrentLevel;
        LoadLevel(_currentLevelNum);

        // Stop any music being played
        SoundController.StopMusic();

        // Start the game paused before the countdown
        _isPaused         = true;
        _updateEveryFrame = UpdateEveryFrame;

        GameInput.AttachInput(
            actionClick: OnButtonClickAction,
            skillClick: OnButtonClickSkill,
            backClick: OnButtonClickBack,
            leftClick: OnButtonClickLeft,
            rightClick: OnButtonClickRight,
            downClick: OnButtonClickDown,
            upClick: OnButtonClickUp);

        // Start the countdown sequence
        StartCountdown();
    }
Example #2
0
 private void PlayStopMusic(bool b)
 {
     if (b)
     {
         soundController.PlayMusic();
     }
     else
     {
         soundController.StopMusic();
     }
 }
Example #3
0
    // Use this for initialization
    void Start()
    {
        StartCoroutine("GameOverTimeout");

        soundController = SoundController.FindSoundController();
        if (soundController)
        {
            soundController.StopMusic();
            soundController.PlayOneShot(gameOverClip);
        }
    }
Example #4
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag.Equals("Player"))
        {
            if (soundController)
            {
                soundController.StopMusic();
                soundController.PlayOneShot(levelCompletedClip);
            }

            gameController.LevelCompleted();
        }
    }
Example #5
0
    public void Exit()
    {
        if (soundController)
        {
            //soundController.PlayOneShot(clickClip);
            soundController.StopMusic();
        }

        timeLeft.timeLeft = 30f;
        FindObjectOfType <PlayerMovement>().health = 100;
        Lives.PlayerLives      = 3;
        ScoreScript.scoreValue = 0;
        FindObjectOfType <InplayUIController>().RestartScene();

        Time.timeScale = 1f;
        //gameController.RestartScene();
        SceneManager.LoadScene("Menu");
    }
Example #6
0
    //GameOver method
    private void GameOver()
    {
        Debug.Log("game over");
        Time.timeScale = 0.0f;
        if (score > highScore)
        {
            highScore = score;
            PlayerPrefs.SetInt("HighScore", highScore);
            ui.SetNewHighScore(highScore);
        }

        sound.StopMusic();
        sound.PlayGameover();

        System.Array.Clear(boardArray, 0, boardArray.Length);
        matchCheckQueue.Clear();
        matchingCoordinates.Clear();

        ui.GameOver();
    }
Example #7
0
    public void ShowPart(GameObject _pt)
    {
        foreach (GameObject _obj in _parts)
        {
            _obj.GetComponent <ObjControll>()._info.SetActive(false);
        }

        FsmVariables.GlobalVariables.GameObjectVariables[0] = _pt;

        _pt.GetComponent <ObjControll>()._info.SetActive(true);

        if (_pt.GetComponent <Animator>() != null)
        {
            _pt.GetComponent <Animator>().Play("action");
        }

        _SOUND.StopMusic(true);
        //string sndName = "whisp1";
        switch (_pt.name)
        {
        case "Obj1": _SOUND.Play("whisp1", 0.4f, 1f); rotangle = 335; break;

        case "Obj2": _SOUND.Play("whisp1", 0.4f, 1f); rotangle = 164; break;

        case "Obj3": _SOUND.Play("whisp1", 0.4f, 1f); rotangle = 287; break;

        case "Obj4": _SOUND.Play("swish", 0.4f, 1f); rotangle = 113; break;

        case "Obj5": _SOUND.Play("water", 0.4f, 1f); rotangle = 224; break;

        case "Obj6": _SOUND.Play("swish", 0.4f, 1f);  rotangle = 76; break;
        //case "Obj7": _SOUND.Play("swish", 0.4f, 1f); break;

        default: break;
        }

        PlayMakerGlobals.Instance.Variables.Vector3Variables[0].Value = new Vector3(0, rotangle, 0);
    }
Example #8
0
    internal static void RegisterKill(Player gotPoint, Player gotKilled, int hits)
    {
        if (State == GameState.RoundFinished)
        {
            return;
        }

        if (isShowDown)
        {
            bool wonRound = false;
            if (activePlayers.Contains(gotKilled))
            {
                activePlayers.Remove(gotKilled);
                if (gotKilled.offscreenDot != null)
                {
                    GameObject.Destroy(gotKilled.offscreenDot);
                }
            }
            if (activePlayers.Count == 1)
            {
                wonRound = true;
                var winner = activePlayers[0];
                if (winner.character != null)
                {
                    winner.character.GetComponent <ScorePlum>().ShowText("WIN!", 5f);
                }
                instance.winningPlayer = winner;
                lastWinningPlayer      = winner;
            }
            else if (isTeamMode)
            {
                bool winnersContainRed  = false;
                bool winnersContainBlue = false;
                foreach (var player in activePlayers)
                {
                    if (player.team == Team.Red)
                    {
                        winnersContainRed = true;
                    }
                    else
                    {
                        winnersContainBlue = true;
                    }
                }

                if (!winnersContainBlue || !winnersContainRed)
                {
                    wonRound = true;
                    var winner = activePlayers[0];
                    if (winner.character != null)
                    {
                        winner.character.GetComponent <ScorePlum>().ShowText("WIN!", 5f);
                    }
                    instance.winningPlayer = winner;
                    lastWinningPlayer      = winner;
                }
            }

            if (wonRound)
            {
                SoundController.PlaySoundEffect("VictorySting", 0.5f);
                SoundController.StopMusic();
                instance.state = GameState.RoundFinished;
            }
            return;
        }

        if (gotPoint != null)
        {
            if (hits <= 0)
            {
                hits = 1;
            }

            if (GameController.isTeamMode)
            {
                if (gotPoint.team == Team.Blue)
                {
                    instance.blueTeamScore += hits;
                }
                else
                {
                    instance.redTeamScore += hits;
                }
            }
            else
            {
                gotPoint.score += hits;
            }

            bool wonRound = false;
            if (GameController.isTeamMode)
            {
                wonRound = ((gotPoint.team == Team.Red && instance.redTeamScore >= 10) || (gotPoint.team == Team.Blue && instance.blueTeamScore >= 10));
            }
            else
            {
                if (activePlayers.Count == 2)
                {
                    wonRound = gotPoint.score >= 5;
                }
                else
                {
                    wonRound = gotPoint.score >= 10;
                }
            }
            if (wonRound)
            {
                SoundController.PlaySoundEffect("VictorySting", 0.5f);
                SoundController.StopMusic();
                instance.state = GameState.RoundFinished;
                instance.GetPlayerScoreDisplay(gotPoint).TemorarilyDisplay("WINNER ! ! !", 5f);
                if (gotPoint.character != null)
                {
                    gotPoint.character.GetComponent <ScorePlum>().ShowText("WIN!", 5f);
                }
                instance.winningPlayer = gotPoint;
                lastWinningPlayer      = gotPoint;
            }
            else
            {
                instance.GetPlayerScoreDisplay(gotPoint).TemorarilyDisplay("+" + hits.ToString());
                if (gotPoint.character != null)
                {
                    gotPoint.character.GetComponent <ScorePlum>().ShowText("+" + hits.ToString());
                }
            }
        }
        else if (gotKilled != null)
        {
            //if (isTeamMode)
            //{
            //    if (gotKilled.team == Team.Blue)
            //        instance.blueTeamScore--;
            //    else
            //        instance.redTeamScore--;
            //}
            //else
            //{
            //    gotKilled.score--;
            //}
            //instance.GetPlayerScoreDisplay(gotKilled).TemorarilyDisplay("-" + 1);
        }

        instance.SortScoreboard();
    }