Exemple #1
0
    // 스코어 표시 중.
    void UpdateScoreWait()
    {
        if (m_resultAnimationIndex >= m_playerIcons.Length)
        {
            return;
        }
        if (m_resultAnimationIndex == 0)
        {
            // 표시 시작.
            int pCount = m_playerScore.GetComponent <UserScore>().GetCount(SushiType.tamago);
            int oCount = m_opponentScore.GetComponent <UserScore>().GetCount(SushiType.tamago);
            m_playerIcons[0].GetComponent <ResultScore>().FadeIn(pCount, pCount * 8);
            m_opponentIcons[0].GetComponent <ResultScore>().FadeIn(oCount, oCount * 8);
            m_resultAnimationIndex = 1;

            return;
        }


        //스코어를 표시합니다.
        ResultScore prs = m_playerIcons[m_resultAnimationIndex - 1].GetComponent <ResultScore>();
        ResultScore ors = m_opponentIcons[m_resultAnimationIndex - 1].GetComponent <ResultScore>();

        //애니메이션이 끝나면 다음 애니메이션을 재생합니다.
        if (prs.IsEnd() && ors.IsEnd())
        {
            if (m_resultAnimationIndex >= m_playerIcons.Length)
            {
                return;
            }

            SushiType[] typeList  = { SushiType.tamago, SushiType.ebi, SushiType.ikura, SushiType.toro };
            int[]       pointList = { 8, 10, 12, 15 }; // 초밥 타입별 득점 정의.

            SushiType type   = typeList[m_resultAnimationIndex];
            int       point  = pointList[m_resultAnimationIndex];
            int       pCount = m_playerScore.GetComponent <UserScore>().GetCount(type);
            int       oCount = m_opponentScore.GetComponent <UserScore>().GetCount(type);

            //득점 표시 시작.
            m_playerIcons[m_resultAnimationIndex].GetComponent <ResultScore>().FadeIn(pCount, pCount * point);
            m_opponentIcons[m_resultAnimationIndex].GetComponent <ResultScore>().FadeIn(oCount, oCount * point);

            m_resultAnimationIndex++;
        }
    }
Exemple #2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        switch (m_state)
        {
        case State.In:
            //배경 페이드 인.
            if (m_resultback.GetComponent <Animation>().isPlaying == false)
            {
                //서버 클라이언트 아이콘 표시를 ON으로 합니다.
                GameObject.Find("server_icon").GetComponent <SpriteRenderer>().enabled = true;
                GameObject.Find("client_icon").GetComponent <SpriteRenderer>().enabled = true;

                //효과음-카운트업음 재생.
                GetComponent <AudioSource>().Play();

                m_state = State.ScoreWait;
            }
            break;

        case State.ScoreWait:
            UpdateScoreWait();  //스코어 표시.

            ResultScore prs = m_playerIcons[3].GetComponent <ResultScore>();
            ResultScore ors = m_opponentIcons[3].GetComponent <ResultScore>();
            if (prs.IsEnd() && ors.IsEnd())
            {
                //표시를 마치고 합계 득점을 표시합니다.
                m_resultPlayer.GetComponent <Number>().SetNum(GetResultScore(m_playerScore));
                m_resultOpponent.GetComponent <Number>().SetNum(GetResultScore(m_opponentScore));
                m_resultPlayer.GetComponent <Animation>().Play("ResultScore");
                m_resultOpponent.GetComponent <Animation>().Play("ResultScore");
                //SE.
                m_resultPlayer.GetComponent <AudioSource>().PlayDelayed(0.75f);
                GetComponent <AudioSource>().Stop(); //카운트업 효과음 정지.

                m_state = State.TotalScore;
            }
            break;

        case State.TotalScore:
            //합계 득점 표시 대기.
            Animation pAnim = m_resultPlayer.GetComponent <Animation>();
            Animation oAnim = m_resultOpponent.GetComponent <Animation>();
            if (pAnim.isPlaying == false && oAnim.isPlaying == false)
            {
                m_state = State.WinLose;
            }
            break;

        case State.WinLose:
            if (m_winlose == null)
            {
                //win/lose 표시 시작.
                if (GetResultScore(m_playerScore) < GetResultScore(m_opponentScore))
                {
                    m_winlose = Instantiate(m_losePrefab) as GameObject;  //패배.
                }
                else
                {
                    m_winlose = Instantiate(m_winPrefab) as GameObject;   //승리.
                }
                m_winlose.name = "winlose";
                return;
            }

            if (m_winlose.GetComponent <Animation>().isPlaying == false)
            {
                Destroy(m_winlose);
                m_state = State.End;
            }
            break;

        case State.End:
            break;
        }
    }