Exemple #1
0
    public void BounceLine(string name)
    {
        Animator animator = null;

        if (name == m_leftLine.name)
        {
            animator = m_leftLine;
        }
        else if (name == m_rightLine.name)
        {
            animator = m_rightLine;
        }
        GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel;

        if (animator != null)
        {
            animator.enabled = true;
            animator.Play("LineAnim");

            audioModuel.PlayAudio("hit_002");
        }
        else
        {
            audioModuel.PlayAudio("hit_001");
        }
    }
    private void HitBallDelegate(Player player, Vector2 direction, float force, int id)
    {
        if (m_gameBall == null)
        {
            return;
        }

        bool checkIsHitArea = PlayerCollider.CheckInHitBallArea(m_gameBall.GetBallInstance().transform, player.Transform,
                                                                player.PlayerData.m_radius, player.PlayerData.m_angle, player.BoxCollider);

        if (checkIsHitArea)
        {
            CameraControl.GetInstance().Trigger();
            CameraControl.GetInstance().TriggerMask();

            GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel;
            if (id == m_player.ID)
            {
                GameEventModuel meoduel = GameStart.GetInstance().EventModuel;
                meoduel.SendEvent(GameEventID.PLAYER_HIT_BALL, true, 0f);

                m_side = ESide.Player;
                m_contestData.AddIndex();

                m_contestUI.FreshUI(m_contestData.m_heart, m_contestData.m_index);
                if (m_contestData != null && m_contestData.m_changeAudio && !m_change)
                {
                    List <string> list = new List <string>
                    {
                        "lerp",
                        "BGM_002",
                    };
                    audioModuel.PlayBgAudio(list);
                    m_change = true;
                }

                m_playerIndex++;
                m_playerIndex = Mathf.Clamp(m_playerIndex, 0, m_audioNameList.Count - 1);
                audioModuel.PlayAudio(m_audioNameList[m_playerIndex]);
            }
            else
            {
                m_side = ESide.AI;
                m_aiIndex++;
                m_aiIndex = Mathf.Clamp(m_aiIndex, 0, m_audioNameList.Count - 1);
                audioModuel.PlayAudio(m_audioNameList[m_aiIndex]);
            }

            if (m_gameBall != null)
            {
                ESide side = (id == m_player.ID) ? ESide.Player : ESide.AI;
                m_gameBall.SetVelocity(direction, force, side);
                m_gameBall.ChangeEffectDir(side);
            }
        }
    }
    private void GameBallOutofRange(GameBall ball)
    {
        Vector3 position = m_gameBall.GetPosition();

        if (position.y > 0)
        {
            m_contestData.AddHeart();
            m_aiIndex = 0;
        }
        else
        {
            m_contestData.ReduceHeart();
            m_playerIndex = 0;
        }

        if (m_contestData != null && !m_contestData.m_changeAudio && m_change)
        {
//			GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel;
//			audioModuel.StopAudio();
        }

        m_contestUI.FreshUI(m_contestData.m_heart, m_contestData.m_index);
        m_gameBall.ResetVelocity();
        m_gameBall.SetPosition(m_ground.GroundData.GetFireBallPoint(ESide.Player));
        m_aiController.SwitchState(EAIControlState.BackToBornPoint);
        if (m_contestData.m_heart < 0)
        {
            m_player.SetIdle();
            m_contestUI.GameEnd();
            m_aiController.gameObject.SetActive(false);

            GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel;
            audioModuel.PlayAudio("lose");
        }
    }
Exemple #4
0
    private void OnBackClick()
    {
        GameAudioModuel moduel = GameStart.GetInstance().AudioModuel;

        moduel.PlayAudio("click_01");
        GameEventModuel eveModuel = GameStart.GetInstance().EventModuel;

        eveModuel.SendEvent(GameEventID.SWITCH_GAME_STATE, true, 0f, EGameStateType.GameMenuState);
    }
Exemple #5
0
    private void OnContinueButtonClick()
    {
        m_mode.SetActive(true);
        m_button.gameObject.SetActive(false);

        GameAudioModuel moduel = GameStart.GetInstance().AudioModuel;

        moduel.PlayAudio("click_01");
    }
Exemple #6
0
    private void HandleTime()
    {
        if (m_bombBall != null && m_start)
        {
            Vector3 position = m_bombBall.GetPosition();
            if (position.y > 1.5f)
            {
                m_aiBombTime += Time.deltaTime;
                if (m_aiBombTime > m_aiTotalBombTime)
                {
                    GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel;
                    m_bombBall.PlayBomb();
                    m_bombUI.ShowEnd(true);

                    if (m_playerController.gameObject.activeSelf)
                    {
                        audioModuel.PlayAudio(new List <string> {
                            "explode_03", "win"
                        });
                    }
                    m_playerController.gameObject.SetActive(false);
                }
                m_end = true;
                float value = m_aiBombTime / m_aiTotalBombTime;
                m_bombBall.SetBombScale(value);
            }
            else if (position.y < -1.5f)
            {
                m_playerBombTime += Time.deltaTime;
                if (m_playerBombTime > m_playerTotalBombTime)
                {
                    GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel;
                    m_bombBall.PlayBomb();
                    //audioModuel.PlayAudio("explode_03");
                    m_bombUI.ShowEnd(false);

                    if (m_playerController.gameObject.activeSelf)
                    {
                        audioModuel.PlayAudio(new List <string> {
                            "explode_03", "lose"
                        });
                    }

                    m_playerController.gameObject.SetActive(false);
                }
                m_end = true;
                float value = m_playerBombTime / m_playerTotalBombTime;
                m_bombBall.SetBombScale(value);
            }
        }
    }