示例#1
0
    //execute one cycle of the current action on the current recorder position
    protected void execRecorderAction()
    {
        if (gOs2propMappings != null)
        {
            foreach (KeyValuePair <GameObject, Object2PropertiesMapping> entry in gOs2propMappings)
            {
                GameObject go = entry.Key;
                Object2PropertiesMapping propMapping = entry.Value;

                if (currentAction == ActionMode.RECORD && currentMode == ViewMode.LIVE)           //if recording

                {
#if IS_UNLICENSED
                    if (recorderPosition <= (100 * (int)ActionMode.STOPPED) / (int)ActionMode.PAUSED)
                    {
#endif
                    maxPositions = recorderPosition;
                    propMapping.insertStateAtPos(recorderPosition);
#if IS_UNLICENSED
                }
                else
                {
                    showingStoppedRecordingMsg = true;
                    StartCoroutine(exitStoppedRecordingMsg(5f));
                    stop();
                }
#endif
                }
                else if (currentMode == ViewMode.REPLAY)             //if replaying
                //if in between start and finish position
                {
                    if ((recorderPosition <= maxPositions && orgRecorderPositionStep > 0) || (recorderPosition > 0 && orgRecorderPositionStep < 0))
                    {
                        //lerping not integrated yet
                        //float updateSyncTime = Time.realtimeSinceStartup;
                        //float lerpInterval = interval - ((updateSyncTime - updateStartingTime) % interval) ;
                        if (propMapping.getGameObjectClone() != null)
                        {
                            propMapping.synchronizeProperties(recorderPosition);
                        }
                    }
                    else                 //else if reached the finishing position
                    {
                        stop();

                        if (exitOnFinished)
                        {
                            switchModeTo(ViewMode.LIVE);
                        }
                    }
                }
            }
        }
    }
示例#2
0
    //execute one cycle of the current action on the current recorder position
    protected void execRecorderAction()
    {
        if (gOs2propMappings != null)
        {
            foreach (KeyValuePair <GameObject, Object2PropertiesMapping> entry in gOs2propMappings)
            {
                GameObject go = entry.Key;
                Object2PropertiesMapping propMapping = entry.Value;

                if (currentAction == ActionMode.RECORD && currentMode == ViewMode.LIVE)   //if recording

                {
#if IS_UNLICENSED
                    if (recorderPosition <= (100 * (int)ActionMode.STOPPED) / (int)ActionMode.PAUSED)
                    {
#endif
                    maxPositions = recorderPosition;
                    propMapping.insertStateAtPos(recorderPosition);

                    int deleted = 0;
                    if (recordingBufferSeconds > 0)
                    {
                        deleted = propMapping.removeFramesOutOfBufferRange();
                    }

                    /*if (deleted > 0) {
                     *  if (propMapping.getGameObject().name.Contains("Shaftbase"))
                     *      print(propMapping.getGameObject() + " deleted: " + deleted + ", remaining: " + propMapping.savedStates.Count);
                     * }*/
#if IS_UNLICENSED
                }
                else
                {
                    showingStoppedRecordingMsg = true;
                    StartCoroutine(exitStoppedRecordingMsg(5f));
                    stop();
                }
#endif
                }
                else if (currentMode == ViewMode.REPLAY)     //if replaying

                //if in between start and finish position
                {
                    int lowestFrame = getLowestFrame();
                    if (recorderPosition <= maxPositions && orgRecorderPositionStep > 0)
                    {
                        propMapping.synchronizeProperties(recorderPosition, recorderPosition == lowestFrame);
                    }
                    else if (recorderPosition >= getLowestFrame() && orgRecorderPositionStep < 0)
                    {
                        //print("recorderPosition: " + recorderPosition);
                        //if (propMapping.getGameObjectClone() != null) {

                        propMapping.synchronizeProperties(recorderPosition, recorderPosition == maxPositions);

                        //}
                    }
                    else     //else if reached the finishing position
                    {
                        stop();

                        if (exitOnFinished)
                        {
                            switchModeTo(ViewMode.LIVE);
                        }
                    }
                }
            }
        }
    }