Exemple #1
0
    public void Init()
    {
        #region 重新初始化;
        //因为这个类是单件,在重新加载场景后,对象销毁了,但是相关的对象引用还在,因此要清除,重新初始化一次;
        if (runners != null)
        {
            for (int i = 0; i < runners.Count; ++i)
            {
                runners[i] = null;
            }
            runners.Clear();
            runners = null;
        }
        runners = new List <BxRunner>();

        if (realTimeRankList != null)
        {
            for (int i = 0; i < realTimeRankList.Count; ++i)
            {
                realTimeRankList[i] = null;
            }
            realTimeRankList.Clear();
            realTimeRankList = null;
        }
        realTimeRankList = new List <RealTimeRank>();
        UIBase.Instance.ReInit();
        #endregion

        for (int i = 0; i < 6; ++i)
        {
            BxRunner obj = new BxRunner(i + 1);
            runners.Add(obj);
            realTimeRankList.Add(new RealTimeRank());
        }
    }
Exemple #2
0
    public void OnRunnerRunOver(BxRunner runner, int usedFrameCount)
    {
        runOverNums++;
        if (usedFrameCount < winnerFrames)
        {
            winnerFrames = usedFrameCount;
        }

        if (runOverNums == 6)
        {
            RealTimeRankLogic.Instance.Show(false);
            StartWait();
        }

        if (runOverNums == 2)
        {
        }
    }
Exemple #3
0
    public void SetGameData(List <int> rank, bool isWin = false)
    {
        //Debug.Log(string.Format("FinalRank:{0} {1} {2} {3} {4} {5}", rank[0], rank[1], rank[2], rank[3], rank[4], rank[5]));

        Time.fixedDeltaTime = Define.FRAME_TIME;

        List <float> costTimes = RandomLib.Instance.GetRaceTimes();

        //Debug.Log(string.Format("Times:{0} {1} {2} {3} {4} {5}", costTimes[0], costTimes[1], costTimes[2], costTimes[3], costTimes[4], costTimes[5]));
        for (int i = 0; i < rank.Count; ++i)
        {
            runners[i].RunwayDestion.localPosition = new Vector3(0, 0, Define.RUNWAY_LENGTH);
            runners[i].SetFinelRank(rank[i], costTimes[rank[i] - 1]);
            if (minTime > costTimes[i])
            {
                winner  = runners[i];
                minTime = costTimes[i];
            }
        }
        RealTimeRankLogic.Instance.ReInit();
    }