Ejemplo n.º 1
0
    void Update()
    {
        if (m_OnCharaSelect)
        {
            for (int i = 1; i < 5; i++)
            {
                if (Input.GetButtonUp("A" + i))
                {
                    AddPlayer(i);
                    m_audioComp.PlaySound(PlayAudio.Son.SelectMenu);
                }

                if (Input.GetButtonUp("B" + i))
                {
                    RemovePlayer(i);
                    m_audioComp.PlaySound(PlayAudio.Son.ClickMenu);
                }

                if (Input.GetButtonUp("Start" + i) && m_isStartable)
                {
                    StartGame();
                    m_audioComp.PlaySound(PlayAudio.Son.SelectMenu);
                }
            }
        }
    }
Ejemplo n.º 2
0
    IEnumerator Victory()
    {
        audioScript.PlaySound(1);
        inputAnswer.text = "";
        victoryScreen.SetActive(true);
        animations.PlayAnimation("VictoryAnimator", 1);
        yield return(new WaitForSeconds(1.5f));

        profile.AddLeaguePoints(Random.Range(80, 120));
        profile.SetPoints();
        animations.PlayAnimation("VictoryAnimator", 2);
        yield return(new WaitForSeconds(.3f));

        victoryScreen.SetActive(false);
        profile.SetElo(Random.Range(13, 20) + (winstreak * 2));
        questionGenerator.NextQuestion();
        profile.SetLPBar();
    }
Ejemplo n.º 3
0
 public void PlayerJump()
 {
     if (_isGrounded && !_pause.IsPaused)
     {
         _rb2D.velocity = new Vector2(_rb2D.velocity.x, _jumpForce); //Boosts player from the ground
         _jumpAudio.PlaySound();                                     //Plays jump sound
         GameObject particle = Instantiate(_jumpParticle);           //Spawn particle
         particle.transform.position = _jumpParticlePos.position;    //Sets the particles position
     }
 }
Ejemplo n.º 4
0
 public void GameOver()
 {
     //If the player dies and his final score is higher than the current highscore
     //Set a new highscore
     if (PlayerInformation.Score >= PlayerInformation.HighScore)
     {
         PlayerInformation.HighScore = PlayerInformation.Score;
     }
     _deathSound.PlaySound();
     _scoreSaver.SaveData();
     _gameOverPanel.SetActive(true);
 }
Ejemplo n.º 5
0
    public void PlayerDied(int joystickId)
    {
        numberOfPlayers--;
        m_playerJoystickList.Remove(joystickId);
        if (numberOfPlayers == 1)
        {
            int playerWinner = m_playerJoystickList[0];
            Debug.Log("PLAYER " + playerWinner + " WON");
            StartCoroutine(gameManager.Endgame(playerWinner));
            m_audioComp.PlaySound(PlayAudio.Son.Victory);

            TextWin.SetActive(true);
            TextWin.GetComponent <Text>().text = "Player " + playerWinner + " Won !";
        }
    }
Ejemplo n.º 6
0
    private void FixedUpdate()
    {
        if (m_isSauced)
        {
            m_timerSauce -= Time.deltaTime;

            if (m_timerSauce <= 0f)
            {
                m_isSauced   = false;
                m_timerSauce = m_timerSauced;

                coefHand = 1f;
                Debug.Log("SAUCE: false");
            }
        }

        if (!m_canGoInVerre)
        {
            m_timerVerre -= Time.deltaTime;

            if (m_timerVerre <= 0f)
            {
                m_canGoInVerre = true;
            }
        }

        if (surface == Surface.Trail)
        {
            m_speed = 1f;
        }
        else
        {
            m_speed = 2f;
        }

        rb.velocity = new Vector3(m_Velocity.x * m_speed, m_Velocity.y, m_Velocity.z * m_speed);

        if ((rb.velocity.x != 0 || rb.velocity.z != 0) && !m_isJumping && !m_inTheVerre)
        {
            if (!GetComponent <ParticleSystem>().isPlaying)
            {
                GetComponent <ParticleSystem>().Play();
            }
            if (audioComp.son != PlayAudio.Son.WalkTable && audioComp.son != PlayAudio.Son.WalkSauce && audioComp.son != PlayAudio.Son.WalkTrail && audioComp.son != PlayAudio.Son.WalkLiquide && audioComp.son != PlayAudio.Son.Hurt)
            {
                switch (surface)
                {
                case Surface.Table:
                    audioComp.PlaySound(PlayAudio.Son.WalkTable);
                    break;

                case Surface.Sauce:
                    audioComp.PlaySound(PlayAudio.Son.WalkSauce);
                    break;

                case Surface.Trail:
                    audioComp.PlaySound(PlayAudio.Son.WalkTrail);
                    break;

                case Surface.Liquide:
                    audioComp.PlaySound(PlayAudio.Son.WalkLiquide);
                    break;
                }
            }
        }
        else if (GetComponent <ParticleSystem>().isPlaying)
        {
            GetComponent <ParticleSystem>().Stop();
        }
    }