예제 #1
0
    int RollLane()
    {
        int laneNo = Random.Range(1, Lanes.GetLaneCount() + 1);

        while (slotOccupied[laneNo - 1])
        {
            laneNo = Random.Range(1, Lanes.GetLaneCount() + 1);
        }
        slotOccupied[laneNo - 1] = true;
        return(laneNo);
    }
예제 #2
0
    int GetNewLaneNo()
    {
        int newLaneNo = LaneNo;

#if UNITY_IOS || UNITY_ANDROID
        Debug.Log(testTouch.GetTouchPosDifference());
        if (testTouch.GetTouchPosDifference().y > 0)
        {
            newLaneNo--;
            if (newLaneNo < 1)
            {
                return(1);
            }
            return(newLaneNo);
        }
        if (testTouch.GetTouchPosDifference().y < 0)
        {
            newLaneNo++;
            if (newLaneNo > Lanes.GetLaneCount())
            {
                return(Lanes.GetLaneCount());
            }
            return(newLaneNo);
        }
#else
        if (testTouch.GetMousePosDifference().y > 0)
        {
            newLaneNo--;
            if (newLaneNo < 1)
            {
                return(1);
            }
            return(newLaneNo);
        }
        if (testTouch.GetMousePosDifference().y < 0)
        {
            newLaneNo++;
            if (newLaneNo > Lanes.GetLaneCount())
            {
                return(Lanes.GetLaneCount());
            }
            return(newLaneNo);
        }
#endif
        return(newLaneNo);
    }