示例#1
0
    int IComparer.Compare(object x, object y)
    {
        ProgressRateZone obX = (ProgressRateZone)x;
        ProgressRateZone obY = (ProgressRateZone)y;

        return(obX.GetProgressRateZoneIndex().CompareTo(obY.GetProgressRateZoneIndex()));
    }
示例#2
0
    public void UpdateCurProgressRateZoneNum(GameObject _objCollided)
    {
        if (curLapNum == MapInfoMgr.getInstance.totalLap)
        {
            return;
        }


        int iTotalProgressZoneNum = progressRateZoneList.Count;

        ProgressRateZone zoneCollided
            = _objCollided.GetComponent <ProgressRateZone>();

        if (zoneCollided == null)
        {
            return;
        }

        if (zoneCollided.GetProgressRateZoneIndex() + (curLapNum * iTotalProgressZoneNum)
            == curProgressRateZoneNum + 1)
        {
            ++curProgressRateZoneNum;
        }
        else
        {
            --curProgressRateZoneNum;
        }

        //Debug.Log("curProgressRateZoneNum : " + curProgressRateZoneNum);
    }
示例#3
0
    public void UpdateCurLap(Collider _Collider)
    {
        if (_Collider.tag != "ProgressRateZone_StartOrEnd")
        {
            return;
        }


        int iTotalProgressZoneNum = progressRateZoneList.Count
                                    - ((MapInfoMgr.getInstance.mapType == MapInfoMgr.MapType.MAP_TYPE_LINE) ? 1 : 0);

        ProgressRateZone zoneCollided
            = _Collider.gameObject.GetComponent <ProgressRateZone>();

        // curLapNum
        if ((curProgressRateZoneNum
             == (iTotalProgressZoneNum * (curLapNum + 1)) - 1))
        //&& ( zoneCollided.GetProgressRateZoneIndex() + (curLapNum * iTotalProgressZoneNum)
        //== curProgressRateZoneNum + 1 )) // Last Area In only one track
        {
            ++curLapNum;
        }
        else
        {
            --curLapNum;
        }

        if (curLapNum < 0)
        {
            curLapNum = 0;
        }


        InMapUIMgr.getInstance.SetCurLap(curLapNum);
        //Debug.Log("curLapNum : " + curLapNum + "/" + MapInfoMgr.getInstance.totalLap);
    }
示例#4
0
 public void AddProgressRateZone(ProgressRateZone _obProgressRateZone)
 {
     progressRateZoneList.Add(_obProgressRateZone);
 }
示例#5
0
    private void UpdateProgressRate()
    {
        if (player == null)
        {
            return;
        }

        if (curProgressRateZoneNum < 0)
        {
            return;
        }

        if (progressRateZoneList.Count == 0 ||
            lineBtweenProgreesRateZoneList.Count == 0 ||
            cumulativeLengthList.Count == 0)
        {
            return;
        }

        if (curLapNum == MapInfoMgr.getInstance.totalLap)
        {
            return;
        }


        int iIndexOfList
            = curProgressRateZoneNum % progressRateZoneList.Count;
        //Debug.Log("iIndexOfList : " + iIndexOfList);

        ProgressRateZone previousZone
            = (ProgressRateZone)progressRateZoneList[iIndexOfList];

        Vector3 vPlayerPositionCurZone
            = player.transform.position - previousZone.transform.position;


        float fLengthInCurZone
            = Vector3.Dot(vPlayerPositionCurZone, (Vector3)lineBtweenProgreesRateZoneList[iIndexOfList]);

        float fTotalCumulativeLengthInOnlyOneTrack
            = (float)cumulativeLengthList[cumulativeLengthList.Count - 1];


        float fCumulativeLength = 0;

        if (iIndexOfList > 0)
        {
            fCumulativeLength = (float)cumulativeLengthList[iIndexOfList - 1];
        }

        curProgressRate = (fCumulativeLength + fLengthInCurZone + (fTotalCumulativeLengthInOnlyOneTrack * curLapNum))
                          / fTotalCumulativeLengthInOnlyOneTrack * MapInfoMgr.getInstance.totalLap;

        //Debug.Log("============================");
        //Debug.Log((float)cumulativeLengthList[iIndexOfList] + fLengthInCurZone
        //    + (fTotalCumulativeLengthInOnlyOneTrack * curLapNum));
        //Debug.Log(fTotalCumulativeLengthInOnlyOneTrack * MapInfoMgr.getInstance.totalLap);
        //Debug.Log("============================");
        ////Debug.Log("curProgressRate : " + curProgressRate);
        InMapUIMgr.getInstance.SetProgressRateBar(curProgressRate);
    }