コード例 #1
0
    void Start()
    {
        m_musicManager   = GameObject.Find("MusicManager").GetComponent <MusicManager>();
        m_scoringManager = GameObject.Find("ScoringManager").GetComponent <ScoringManager>();
        m_eventManager   = GameObject.Find("EventManager").GetComponent <EventManager>();

        //因为GUI对象有Inactie的可能性,所以不能在Find直接访问。
        m_onPlayGUI    = GameObject.Find("PhaseManager").GetComponent <PhaseManager>().guiList[1].GetComponent <OnPlayGUI>();
        m_playerAction = GameObject.Find("PlayerAvator").GetComponent <PlayerAction>();
        m_seekSlider.is_now_dragging    = false;
        m_seekSlider.dragging_poisition = 0.0f;
    }
コード例 #2
0
ファイル: PhaseManager.cs プロジェクト: mackhan/RockBand
    /// <summary>
    /// 游戏开始的逻辑
    /// </summary>
    /// <param name="_bDevelopment"></param>
    void Play(bool _bDevelopment)
    {
        DeactiveateAllGUI();
        ActivateGUI("OnPlayGUI");
        if (_bDevelopment)
        {
            ActivateGUI("DevelopmentModeGUI");
        }

        //从csv读取歌曲数据
        TextReader textReader = new StringReader(
            System.Text.Encoding.UTF8.GetString((Resources.Load(SongName + "songInfoCSV") as TextAsset).bytes));
        SongInfo       songInfo = new SongInfo();
        SongInfoLoader loader   = new SongInfoLoader();

        loader.songInfo = songInfo;
        loader.ReadCSV(SongName, textReader);
        m_musicManager.currentSongInfo = songInfo;

        //-三波观众开始动起来
        foreach (GameObject audience in GameObject.FindGameObjectsWithTag("Audience"))
        {
            audience.GetComponent <SimpleActionMotor>().isWaveBegin = true;
        }

        //-各种效果动画(舞台演出等)开始
        GameObject.Find("EventManager").GetComponent <EventManager>().BeginEventSequence();

        //-得分评价开始
        m_scoringManager.BeginScoringSequence();

        //-节奏序列绘制开始
        OnPlayGUI onPlayGUI = GameObject.Find("OnPlayGUI").GetComponent <OnPlayGUI>();

        onPlayGUI.BeginVisualization();
        onPlayGUI.isDevelopmentMode = _bDevelopment;

        //-绘制开发版的特殊界面
        if (_bDevelopment)
        {
            GameObject.Find("DevelopmentModeGUI").GetComponent <DevelopmentModeGUI>().BeginVisualization();
        }

        //开始播放音乐
        m_musicManager.PlayMusicFromStart();
    }
コード例 #3
0
    public void SetPhase(string nextPhase)
    {
        switch (nextPhase)
        {
        //スタートメニュー
        case "Startup":
            DeactiveateAllGUI();
            ActivateGUI("StartupMenuGUI");
            break;

        //説明
        case "OnBeginInstruction":
            DeactiveateAllGUI();
            ActivateGUI("InstructionGUI");
            ActivateGUI("OnPlayGUI");
            break;

        //メインゲーム
        case "Play":
        {
            DeactiveateAllGUI();
            ActivateGUI("OnPlayGUI");
            //csvから曲データ読み込み
            TextReader textReader
                = new StringReader(
                      System.Text.Encoding.UTF8.GetString((Resources.Load("SongInfo/songInfoCSV") as TextAsset).bytes)
                      );
            SongInfo       songInfo = new SongInfo();
            SongInfoLoader loader   = new SongInfoLoader();
            loader.songInfo = songInfo;
            loader.ReadCSV(textReader);
            m_musicManager.currentSongInfo = songInfo;

            foreach (GameObject audience in GameObject.FindGameObjectsWithTag("Audience"))
            {
                audience.GetComponent <SimpleActionMotor>().isWaveBegin = true;
            }
            //イベント(ステージ演出等)開始
            GameObject.Find("EventManager").GetComponent <EventManager>().BeginEventSequence();
            //スコア評価開始
            m_scoringManager.BeginScoringSequence();
            //リズムシーケンス描画開始
            OnPlayGUI onPlayGUI = GameObject.Find("OnPlayGUI").GetComponent <OnPlayGUI>();
            onPlayGUI.BeginVisualization();
            onPlayGUI.isDevelopmentMode = false;
            //演奏開始
            m_musicManager.PlayMusicFromStart();
        }
        break;

        case "DevelopmentMode":
        {
            DeactiveateAllGUI();
            ActivateGUI("DevelopmentModeGUI");
            ActivateGUI("OnPlayGUI");
            //csvから曲データ読み込み
            TextReader textReader
                = new StringReader(
                      System.Text.Encoding.UTF8.GetString((Resources.Load("SongInfo/songInfoCSV") as TextAsset).bytes)
                      );
            SongInfo       songInfo = new SongInfo();
            SongInfoLoader loader   = new SongInfoLoader();
            loader.songInfo = songInfo;
            loader.ReadCSV(textReader);
            m_musicManager.currentSongInfo = songInfo;

            foreach (GameObject audience in GameObject.FindGameObjectsWithTag("Audience"))
            {
                audience.GetComponent <SimpleActionMotor>().isWaveBegin = true;
            }
            //イベント(ステージ演出等)開始
            GameObject.Find("EventManager").GetComponent <EventManager>().BeginEventSequence();
            //スコア評価開始
            m_scoringManager.BeginScoringSequence();
            //リズムシーケンス描画開始
            OnPlayGUI onPlayGUI = GameObject.Find("OnPlayGUI").GetComponent <OnPlayGUI>();
            onPlayGUI.BeginVisualization();
            onPlayGUI.isDevelopmentMode = true;
            //developモード専用GUIシーケンス描画開始
            GameObject.Find("DevelopmentModeGUI").GetComponent <DevelopmentModeGUI>().BeginVisualization();
            //演奏開始
            m_musicManager.PlayMusicFromStart();
        }
        break;

        case "GameOver":
        {
            DeactiveateAllGUI();
            ActivateGUI("ShowResultGUI");
            ShowResultGUI showResult = GameObject.Find("ShowResultGUI").GetComponent <ShowResultGUI>();
            //スコア依存のメッセージを表示
            Debug.Log(m_scoringManager.scoreRate);
            Debug.Log(ScoringManager.failureScoreRate);
            if (m_scoringManager.scoreRate <= ScoringManager.failureScoreRate)
            {
                showResult.comment = showResult.comment_BAD;
                GameObject.Find("Vocalist").GetComponent <BandMember>().BadFeedback();
            }
            else if (m_scoringManager.scoreRate >= ScoringManager.excellentScoreRate)
            {
                showResult.comment = showResult.comment_EXCELLENT;
                GameObject.Find("Vocalist").GetComponent <BandMember>().GoodFeedback();
                GameObject.Find("AudienceVoice").GetComponent <AudioSource>().Play();
            }
            else
            {
                showResult.comment = showResult.comment_GOOD;
                GameObject.Find("Vocalist").GetComponent <BandMember>().GoodFeedback();
            }
        }
        break;

        case "Restart":
        {
            Application.LoadLevel("Main");
        }
        break;

        default:
            Debug.LogError("unknown phase: " + nextPhase);
            break;
        }        //end of switch

        m_currentPhase = nextPhase;
    }