Exemple #1
0
        public object GetSaveData()
        {
            if (!actionDoor)
            {
                return(null);
            }

            ActionDoorData_v1 data = new ActionDoorData_v1();

            data.loadID           = LoadID;
            data.currentLockValue = actionDoor.CurrentLockValue;
            data.currentRotation  = transform.rotation;
            data.currentState     = actionDoor.CurrentState;

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

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

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

            ActionDoorData_v1 data = new ActionDoorData_v1();
            data.loadID = LoadID;
            data.currentLockValue = actionDoor.CurrentLockValue;
            data.currentRotation = transform.rotation;
            data.currentState = actionDoor.CurrentState;

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

            return data;
        }
        void RestoreActionDoorData(ActionDoorData_v1[] actionDoors)
        {
            if (actionDoors == null || actionDoors.Length == 0)
                return;

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