コード例 #1
0
ファイル: GameMenuState.cs プロジェクト: LeoguoEx/miniTennis
    public override void EnterState()
    {
        m_startUI = GameStart.GetInstance().UIModuel.LoadResUI <GameStartUI>("StartUI");
        GameAudioModuel moduel = GameStart.GetInstance().AudioModuel;

        moduel.PlayBgAudio("BGM_001");
    }
コード例 #2
0
    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);
            }
        }
    }