예제 #1
0
    public override void IReplayObserver_Seek_Replay(bool bIsFirstFrame, float fTime)
    {
        if (CheckDebugFilter(EDebugFilter.Debug_Level_Core))
        {
            Debug.Log($"{GetType().GetFriendlyName()}  {nameof(IReplayObserver_Seek_Replay)} Contain Replay Data Count : {_listReplayData.Count}" + " bIsFirstFrame : " + bIsFirstFrame + " fTime : " + fTime);
        }

        // 못찾을 경우 -1을 리턴
        int iFindStartIndex = _listReplayData.Calculate_StartIndex(fTime);

        iFindStartIndex -= 1;
        if (iFindStartIndex >= 0)
        {
            for (int i = iFindStartIndex; i < _listReplayData.Count; i++)
            {
                ReplayDataList <CommandExcuted> .SReplayData sReplayData = _listReplayData[i];
                if (_fPrevSeekTime <= sReplayData.fRecordTime)
                {
                    if (sReplayData.fRecordTime > fTime)
                    {
                        break;
                    }

                    sReplayData.IRecordData_GetData().DoExcute();
                }
            }
        }

        _fPrevSeekTime = fTime;
    }
예제 #2
0
    /* protected - [abstract & virtual]         */


    // ========================================================================== //

    #region Private

    private void SeekReplay <T>(float fTime, ReplayDataList <T> listRecordData, System.Action <T> OnReplay, System.Func <T, T, float, T> OnLerp)
    {
        int iFindStartIndex = listRecordData.Calculate_StartIndex(fTime);

        if (iFindStartIndex != listRecordData.Count - 1)
        {
            var pNextRecordData    = listRecordData[iFindStartIndex + 1];
            var pCurrentRecordData = listRecordData[iFindStartIndex];

            float fProgress = fTime.Convert_ThisValue_To_Delta_0_1(pNextRecordData.IRecordData_GetRecordTime(), pCurrentRecordData.IRecordData_GetRecordTime());
            OnReplay(OnLerp(pCurrentRecordData.IRecordData_GetData(), pNextRecordData.IRecordData_GetData(), fProgress));
        }
        else
        {
            OnReplay(listRecordData[iFindStartIndex].IRecordData_GetData());
        }
    }