예제 #1
0
    TaiguDrumBall CreateMixBall()
    {
        GameObject go = null;

        go       = (GameObject)Instantiate(m_MixBallPreb, m_MixBallPreb.transform.position, m_MixBallPreb.transform.rotation);
        go.layer = (int)GameLayer.UI;
        go.name  = "Mix";

        TaiguDrumBall drumBall = go.GetComponent <TaiguDrumBall>();

        drumBall.ResizeHoldBall(0);
        return(drumBall);
    }
예제 #2
0
    TaiguDrumBall CreateHoldBall(float nKeyTimeSpace)
    {
        GameObject go = null;

        go       = (GameObject)Instantiate(m_HoldBallPreb, m_HoldBallPreb.transform.position, m_HoldBallPreb.transform.rotation);
        go.layer = (int)GameLayer.UI;
        go.name  = "Hold" + nHoldIndex.ToString();      //	给实例命名方便调试;
        nHoldIndex++;

        TaiguDrumBall drumBall = go.GetComponent <TaiguDrumBall>();

        drumBall.ResizeHoldBall(nKeyTimeSpace * mBallSpeed * 240.0f);
        return(drumBall);
    }
예제 #3
0
    TaiguDrumBall ObtainDrumBall(TaiguBallType ballType, float nKeyTimeSpace)
    {
        TaiguDrumBall drumBall = null;

        switch (ballType)
        {
        case TaiguBallType.Red:
            if (mUnuseRedBalls.Count > 0)
            {
                drumBall = mUnuseRedBalls.Dequeue();
                drumBall.gameObject.SetActive(true);
            }
            else
            {
                drumBall = CreateRedBall();
            }
            break;

        case TaiguBallType.Blue:
            if (mUnuseBlueBalls.Count > 0)
            {
                drumBall = mUnuseBlueBalls.Dequeue();
                drumBall.gameObject.SetActive(true);
            }
            else
            {
                drumBall = CreateBlueBall();
            }
            break;

        case TaiguBallType.RBMix:
            if (mUnuseMixBalls.Count > 0)
            {
                drumBall = mUnuseMixBalls.Dequeue();
                drumBall.gameObject.SetActive(true);
            }
            else
            {
                drumBall = CreateMixBall();
            }
            break;

        case TaiguBallType.HoldBegin:
            if (mUnuseHoldBalls.Count > 0)
            {
                drumBall = mUnuseHoldBalls.Dequeue();
                drumBall.ResizeHoldBall(nKeyTimeSpace * mBallSpeed * 240.0f);
                drumBall.gameObject.SetActive(true);
            }
            else
            {
                drumBall = CreateHoldBall(nKeyTimeSpace);
            }
            break;
        }

        Vector3 pos = m_BallCaptain.transform.position;

        pos.x  = m_BeginPos.position.x;
        pos.z += mBallDepth * 0.001f;
        drumBall.transform.parent     = m_BallCaptain.transform;
        drumBall.transform.localScale = Vector3.one;
        drumBall.transform.position   = pos;
        mBallDepth++;

        return(drumBall);
    }