Example #1
0
        public object GetSaveData()
        {
            if (!action)
            {
                return(null);
            }

            ActionObjectData_v1 data = new ActionObjectData_v1();

            data.loadID          = LoadID;
            data.currentPosition = action.transform.position;
            data.currentRotation = action.transform.rotation;
            data.currentState    = action.CurrentState;

            if (action.IsMoving)
            {
                __ExternalAssets.iTween tween = GetComponent <__ExternalAssets.iTween>();
                if (tween)
                {
                    data.actionPercentage = tween.Percentage;
                }
            }

            return(data);
        }
Example #2
0
        public void RestoreSaveData(object dataIn)
        {
            ActionObjectData_v1 data = (ActionObjectData_v1)dataIn;

            if (data.loadID == LoadID)
            {
                action.transform.position = data.currentPosition;
                action.transform.rotation = data.currentRotation;
                action.CurrentState       = data.currentState;
                action.RestartTween(1 - data.actionPercentage);
            }
        }
        public object GetSaveData()
        {
            if (!action)
                return null;

            ActionObjectData_v1 data = new ActionObjectData_v1();
            data.loadID = LoadID;
            data.currentPosition = action.transform.position;
            data.currentRotation = action.transform.rotation;
            data.currentState = action.CurrentState;

            if (action.IsMoving)
            {
                __ExternalAssets.iTween tween = GetComponent<__ExternalAssets.iTween>();
                if (tween)
                {
                    data.actionPercentage = tween.Percentage;
                }
            }

            return data;
        }
        void RestoreActionObjectData(ActionObjectData_v1[] actionObjects)
        {
            if (actionObjects == null || actionObjects.Length == 0)
                return;

            for (int i = 0; i < actionObjects.Length; i++)
            {
                long key = actionObjects[i].loadID;
                if (serializableActionObjects.ContainsKey(key))
                {
                    serializableActionObjects[key].RestoreSaveData(actionObjects[i]);
                }
            }
        }