Пример #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        //FIXED_NUM개마다 확정 & 표시를 리셋시킵니다.
        if (m_scoreSushi.Count >= FIXED_NUM)
        {
            if (m_scoreSushi[0].GetComponent <ScoreSushi>().IsFadeOut())
            {
                //연출 대기-------------------------------------------
                for (int i = 0; i < FIXED_NUM; ++i)
                {
                    ScoreSushi sushi = m_scoreSushi[i].GetComponent <ScoreSushi>();
                    if (sushi.IsFadeOutEnd() == false)
                    {
                        return;
                    }
                }

                //SE.
                GetComponent <AudioSource>().Play();
                //소화 애니메이션이 끝났으므로 지웁니다.
                for (int i = 0; i < FIXED_NUM; ++i)
                {
                    ScoreSushi sushi = m_scoreSushi[i].GetComponent <ScoreSushi>();
                    m_fixedScore[sushi.m_sushiType]++;
                    Destroy(m_scoreSushi[i]);
                }
                m_scoreSushi.RemoveRange(0, FIXED_NUM);

                //남아 있는 표시물의 위치 맞추기.
                for (int i = 0; i < m_scoreSushi.Count; ++i)
                {
                    Vector3 pos = MakePosition(m_userType, i);
                    m_scoreSushi[i].transform.position = pos;
                }

                return;
            }
            else
            {
                //소화 준비-------------------------------------------
                //소화 애니메이션이 끝나고 나서 삭제해 주세요.
                GameObject dog    = GameObject.Find(m_userType.ToString() + "Dog");
                Vector3    target = dog.transform.FindChild("target").position;
                for (int i = 0; i < FIXED_NUM; ++i)
                {
                    ScoreSushi sushi = m_scoreSushi[i].GetComponent <ScoreSushi>();
                    sushi.StartFadeOut(target); //연출 시작.
                }
            }
        }
    }
Пример #2
0
    //스코어 획득.
    public int GetCount(SushiType sushiType)
    {
        //획득 완료되지 않은 것(표시분)을 카운트.
        int count = 0;

        foreach (GameObject obj in m_scoreSushi)
        {
            ScoreSushi sushi = obj.GetComponent <ScoreSushi>();
            SushiType  type  = sushi.m_sushiType;
            if (type == sushiType)
            {
                count++;
            }
        }

        //획득된 것과 더해서 반환합니다.
        return(m_fixedScore[sushiType] + count);
    }