/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { VideoPlayerData videoPlayerData = new VideoPlayerData(); videoPlayerData.objectID = constantID; videoPlayerData.savePrevented = savePrevented; if (GetComponent <VideoPlayer>()) { VideoPlayer videoPlayer = GetComponent <VideoPlayer>(); videoPlayerData.isPlaying = videoPlayer.isPlaying; videoPlayerData.currentFrame = videoPlayer.frame; videoPlayerData.currentTime = videoPlayer.time; if (saveClipAsset) { if (videoPlayer.clip != null) { videoPlayerData.clipAssetID = AssetLoader.GetAssetInstanceID(videoPlayer.clip); } } } return(Serializer.SaveScriptData <VideoPlayerData> (videoPlayerData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { TimelineData timelineData = new TimelineData(); timelineData.objectID = constantID; timelineData.savePrevented = savePrevented; #if UNITY_2017_1_OR_NEWER PlayableDirector director = GetComponent <PlayableDirector>(); timelineData.isPlaying = (director.state == PlayState.Playing); timelineData.currentTime = director.time; timelineData.trackObjectData = ""; timelineData.timelineAssetID = ""; if (director.playableAsset != null) { TimelineAsset timeline = (TimelineAsset)director.playableAsset; if (timeline != null) { if (saveTimelineAsset) { timelineData.timelineAssetID = AssetLoader.GetAssetInstanceID(timeline); } if (saveBindings) { int[] bindingIDs = new int[timeline.outputTrackCount]; for (int i = 0; i < bindingIDs.Length; i++) { TrackAsset trackAsset = timeline.GetOutputTrack(i); GameObject trackObject = director.GetGenericBinding(trackAsset) as GameObject; bindingIDs[i] = 0; if (trackObject != null) { ConstantID cIDComponent = trackObject.GetComponent <ConstantID>(); if (cIDComponent != null) { bindingIDs[i] = cIDComponent.constantID; } } } for (int i = 0; i < bindingIDs.Length; i++) { timelineData.trackObjectData += bindingIDs[i].ToString(); if (i < (bindingIDs.Length - 1)) { timelineData.trackObjectData += ","; } } } } } #else ACDebug.LogWarning("The 'Remember Director' component is only compatible with Unity 5.6 onward.", this); #endif return(Serializer.SaveScriptData <TimelineData> (timelineData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { NPCData npcData = new NPCData(); npcData.objectID = constantID; if (gameObject.layer == LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer)) { npcData.isOn = true; } else { npcData.isOn = false; } npcData.LocX = transform.position.x; npcData.LocY = transform.position.y; npcData.LocZ = transform.position.z; npcData.RotX = transform.eulerAngles.x; npcData.RotY = transform.eulerAngles.y; npcData.RotZ = transform.eulerAngles.z; npcData.ScaleX = transform.localScale.x; npcData.ScaleY = transform.localScale.y; npcData.ScaleZ = transform.localScale.z; if (GetComponent <NPC>()) { NPC npc = GetComponent <NPC>(); npcData = npc.SaveData(npcData); } return(Serializer.SaveScriptData <NPCData> (npcData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { ContainerData containerData = new ContainerData(); containerData.objectID = constantID; containerData.savePrevented = savePrevented; if (_Container != null) { List <int> linkedIDs = new List <int>(); List <int> counts = new List <int>(); List <int> IDs = new List <int>(); for (int i = 0; i < _Container.items.Count; i++) { linkedIDs.Add(_Container.items[i].linkedID); counts.Add(_Container.items[i].count); IDs.Add(_Container.items[i].id); } containerData._linkedIDs = ArrayToString <int> (linkedIDs.ToArray()); containerData._counts = ArrayToString <int> (counts.ToArray()); containerData._IDs = ArrayToString <int> (IDs.ToArray()); } return(Serializer.SaveScriptData <ContainerData> (containerData)); }
public override string SaveData() { ShapeableData shapeableData = new ShapeableData(); shapeableData.objectID = constantID; shapeableData.savePrevented = savePrevented; Shapeable shapeable = GetComponent <Shapeable>(); if (shapeable != null) { List <int> activeKeyIDs = new List <int>(); List <float> values = new List <float>(); foreach (ShapeGroup shapeGroup in shapeable.shapeGroups) { activeKeyIDs.Add(shapeGroup.GetActiveKeyID()); values.Add(shapeGroup.GetActiveKeyValue()); } shapeableData._activeKeyIDs = ArrayToString <int> (activeKeyIDs.ToArray()); shapeableData._values = ArrayToString <float> (values.ToArray()); } return(Serializer.SaveScriptData <ShapeableData> (shapeableData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { VisibilityData visibilityData = new VisibilityData(); visibilityData.objectID = constantID; visibilityData.savePrevented = savePrevented; if (GetComponent <SpriteFader>()) { SpriteFader spriteFader = GetComponent <SpriteFader>(); visibilityData.isFading = spriteFader.isFading; if (spriteFader.isFading) { if (spriteFader.fadeType == FadeType.fadeIn) { visibilityData.isFadingIn = true; } else { visibilityData.isFadingIn = false; } visibilityData.fadeTime = spriteFader.fadeTime; visibilityData.fadeStartTime = spriteFader.fadeStartTime; } visibilityData.fadeAlpha = GetComponent <SpriteRenderer>().color.a; } else if (GetComponent <SpriteRenderer>() && saveColour) { Color _color = GetComponent <SpriteRenderer>().color; visibilityData.colourR = _color.r; visibilityData.colourG = _color.g; visibilityData.colourB = _color.b; visibilityData.colourA = _color.a; } if (GetComponent <FollowTintMap>()) { visibilityData = GetComponent <FollowTintMap>().SaveData(visibilityData); } if (limitVisibility) { visibilityData.isOn = !limitVisibility.isLockedOff; } else if (GetComponent <Renderer>()) { visibilityData.isOn = GetComponent <Renderer>().enabled; } else if (affectChildren) { foreach (Renderer _renderer in GetComponentsInChildren <Renderer>()) { visibilityData.isOn = _renderer.enabled; break; } } return(Serializer.SaveScriptData <VisibilityData> (visibilityData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { NavMesh2DData navMesh2DData = new NavMesh2DData(); navMesh2DData.objectID = constantID; if (GetComponent <NavigationMesh>()) { NavigationMesh navMesh = GetComponent <NavigationMesh>(); List <int> linkedIDs = new List <int>(); for (int i = 0; i < navMesh.polygonColliderHoles.Count; i++) { if (navMesh.polygonColliderHoles[i].GetComponent <ConstantID>()) { linkedIDs.Add(navMesh.polygonColliderHoles[i].GetComponent <ConstantID>().constantID); } else { ACDebug.LogWarning("Cannot save " + this.gameObject.name + "'s holes because " + navMesh.polygonColliderHoles[i].gameObject.name + " has no Constant ID!"); } } navMesh2DData._linkedIDs = ArrayToString <int> (linkedIDs.ToArray()); } return(Serializer.SaveScriptData <NavMesh2DData> (navMesh2DData)); }
public override string SaveData() { ContainerData containerData = new ContainerData(); containerData.objectID = constantID; if (GetComponent <Container>()) { Container container = GetComponent <Container>(); List <int> linkedIDs = new List <int>(); List <int> counts = new List <int>(); List <int> IDs = new List <int>(); for (int i = 0; i < container.items.Count; i++) { linkedIDs.Add(container.items[i].linkedID); counts.Add(container.items[i].count); IDs.Add(container.items[i].id); } containerData._linkedIDs = ArrayToString <int> (linkedIDs.ToArray()); containerData._counts = ArrayToString <int> (counts.ToArray()); containerData._IDs = ArrayToString <int> (IDs.ToArray()); } return(Serializer.SaveScriptData <ContainerData> (containerData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { TriggerData triggerData = new TriggerData(); triggerData.objectID = constantID; triggerData.savePrevented = savePrevented; Collider _collider = GetComponent <Collider>(); if (_collider) { triggerData.isOn = _collider.enabled; } else { Collider2D _collider2D = GetComponent <Collider2D>(); if (_collider2D) { triggerData.isOn = _collider2D.enabled; } else { triggerData.isOn = false; } } return(Serializer.SaveScriptData <TriggerData> (triggerData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { Sound sound = GetComponent <Sound>(); AudioSource audioSource = GetComponent <AudioSource>(); SoundData soundData = new SoundData(); soundData.objectID = constantID; if (sound.IsFadingOut()) { soundData.isPlaying = false; } else { soundData.isPlaying = sound.IsPlaying(); } soundData.isLooping = audioSource.loop; soundData.samplePoint = audioSource.timeSamples; soundData.relativeVolume = sound.relativeVolume; if (audioSource.clip != null) { soundData.clipID = AssetLoader.GetAssetInstanceID(audioSource.clip); } return(Serializer.SaveScriptData <SoundData> (soundData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { ConversationData conversationData = new ConversationData(); conversationData.objectID = constantID; conversationData.savePrevented = savePrevented; if (_Conversation) { List <bool> optionStates = new List <bool>(); List <bool> optionLocks = new List <bool>(); List <bool> optionChosens = new List <bool>(); List <string> optionLabels = new List <string>(); List <int> optionLineIDs = new List <int>(); foreach (ButtonDialog _option in _Conversation.options) { optionStates.Add(_option.isOn); optionLocks.Add(_option.isLocked); optionChosens.Add(_option.hasBeenChosen); optionLabels.Add(_option.label); optionLineIDs.Add(_option.lineID); } conversationData._optionStates = ArrayToString <bool> (optionStates.ToArray()); conversationData._optionLocks = ArrayToString <bool> (optionLocks.ToArray()); conversationData._optionChosens = ArrayToString <bool> (optionChosens.ToArray()); conversationData._optionLabels = ArrayToString <string> (optionLabels.ToArray()); conversationData._optionLineIDs = ArrayToString <int> (optionLineIDs.ToArray()); conversationData.lastOption = _Conversation.lastOption; } return(Serializer.SaveScriptData <ConversationData> (conversationData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { NPCData npcData = new NPCData(); npcData.objectID = constantID; npcData.savePrevented = savePrevented; if (OwnHotspot != null) { npcData.isOn = OwnHotspot.IsOn(); } npcData.LocX = transform.position.x; npcData.LocY = transform.position.y; npcData.LocZ = transform.position.z; npcData.RotX = transform.eulerAngles.x; npcData.RotY = transform.eulerAngles.y; npcData.RotZ = transform.eulerAngles.z; npcData.ScaleX = transform.localScale.x; npcData.ScaleY = transform.localScale.y; npcData.ScaleZ = transform.localScale.z; if (GetComponent <NPC>()) { NPC npc = GetComponent <NPC>(); npcData = npc.SaveData(npcData); } return(Serializer.SaveScriptData <NPCData> (npcData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { HotspotData hotspotData = new HotspotData(); hotspotData.objectID = constantID; if (gameObject.layer == LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer)) { hotspotData.isOn = true; } else { hotspotData.isOn = false; } if (GetComponent <Hotspot>()) { Hotspot _hotspot = GetComponent <Hotspot>(); hotspotData.buttonStates = ButtonStatesToString(_hotspot); hotspotData.hotspotName = _hotspot.GetName(0); hotspotData.displayLineID = _hotspot.displayLineID; } return(Serializer.SaveScriptData <HotspotData> (hotspotData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { TimelineData timelineData = new TimelineData(); timelineData.objectID = constantID; timelineData.savePrevented = savePrevented; PlayableDirector director = GetComponent <PlayableDirector>(); timelineData.isPlaying = (director.state == PlayState.Playing); timelineData.currentTime = director.time; timelineData.trackObjectData = string.Empty; timelineData.timelineAssetID = string.Empty; if (director.playableAsset != null) { #if !ACIgnoreTimeline TimelineAsset timeline = (TimelineAsset)director.playableAsset; if (timeline != null) { if (saveTimelineAsset) { timelineData.timelineAssetID = AssetLoader.GetAssetInstanceID(timeline); } if (saveBindings) { int[] bindingIDs = new int[timeline.outputTrackCount]; for (int i = 0; i < bindingIDs.Length; i++) { TrackAsset trackAsset = timeline.GetOutputTrack(i); GameObject trackObject = director.GetGenericBinding(trackAsset) as GameObject; bindingIDs[i] = 0; if (trackObject != null) { ConstantID cIDComponent = trackObject.GetComponent <ConstantID>(); if (cIDComponent != null) { bindingIDs[i] = cIDComponent.constantID; } } } for (int i = 0; i < bindingIDs.Length; i++) { timelineData.trackObjectData += bindingIDs[i].ToString(); if (i < (bindingIDs.Length - 1)) { timelineData.trackObjectData += ","; } } } } #endif } return(Serializer.SaveScriptData <TimelineData> (timelineData)); }
public override string SaveData () { NameData nameData = new NameData(); nameData.objectID = constantID; nameData.newName = gameObject.name; return Serializer.SaveScriptData <NameData> (nameData); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { Sound sound = GetComponent <Sound>(); SoundData soundData = new SoundData(); soundData.objectID = constantID; soundData = sound.GetSaveData(soundData); return(Serializer.SaveScriptData <SoundData> (soundData)); }
public override string SaveData() { AnimatorData animatorData = new AnimatorData(); animatorData.objectID = constantID; animatorData.parameterData = ParameterValuesToString(_animator.parameters); animatorData.layerWeightData = LayerWeightsToString(); animatorData.stateData = StatesToString(); return(Serializer.SaveScriptData <AnimatorData> (animatorData)); }
public override string SaveData() { VariablesData data = new VariablesData(); foreach (GVar var in Variables.vars) { var.Download(VariableLocation.Component); } data.variablesData = SaveSystem.CreateVariablesData(Variables.vars, false, VariableLocation.Component); return(Serializer.SaveScriptData <VariablesData> (data)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { FootstepSoundData footstepSoundData = new FootstepSoundData(); footstepSoundData.objectID = constantID; footstepSoundData.savePrevented = savePrevented; if (GetComponent <FootstepSounds>()) { FootstepSounds footstepSounds = GetComponent <FootstepSounds>(); footstepSoundData.walkSounds = SoundsToString(footstepSounds.footstepSounds); footstepSoundData.runSounds = SoundsToString(footstepSounds.runSounds); } return(Serializer.SaveScriptData <FootstepSoundData> (footstepSoundData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { VideoPlayerData videoPlayerData = new VideoPlayerData(); videoPlayerData.objectID = constantID; videoPlayerData.savePrevented = savePrevented; if (GetComponent <VideoPlayer>()) { VideoPlayer videoPlayer = GetComponent <VideoPlayer>(); videoPlayerData.isPlaying = videoPlayer.isPlaying; videoPlayerData.currentFrame = videoPlayer.frame; videoPlayerData.currentTime = videoPlayer.time; } return(Serializer.SaveScriptData <VideoPlayerData> (videoPlayerData)); }
public override string SaveData() { ConversationData conversationData = new ConversationData(); conversationData.objectID = constantID; if (GetComponent <Conversation>()) { bool[] optionStates = GetComponent <Conversation>().GetOptionStates(); conversationData._optionStates = ArrayToString <bool> (optionStates); bool[] optionLocks = GetComponent <Conversation>().GetOptionLocks(); conversationData._optionLocks = ArrayToString <bool> (optionLocks); } return(Serializer.SaveScriptData <ConversationData> (conversationData)); }
public override string SaveData() { MoveableData moveableData = new MoveableData(); moveableData.objectID = constantID; moveableData.savePrevented = savePrevented; Moveable_Drag moveable_Drag = GetComponent <Moveable_Drag>(); if (moveable_Drag) { moveableData.isOn = moveable_Drag.IsOn(); moveableData.trackID = 0; if (moveable_Drag.dragMode == DragMode.LockToTrack && moveable_Drag.track && moveable_Drag.track.GetComponent <ConstantID>()) { moveableData.trackID = moveable_Drag.track.GetComponent <ConstantID>().constantID; } moveableData.trackValue = moveable_Drag.trackValue; moveableData.revolutions = moveable_Drag.revolutions; } else { moveableData.isOn = (gameObject.layer == LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer)); } moveableData.LocX = transform.position.x; moveableData.LocY = transform.position.y; moveableData.LocZ = transform.position.z; moveableData.RotX = transform.eulerAngles.x; moveableData.RotY = transform.eulerAngles.y; moveableData.RotZ = transform.eulerAngles.z; moveableData.ScaleX = transform.localScale.x; moveableData.ScaleY = transform.localScale.y; moveableData.ScaleZ = transform.localScale.z; Moveable moveable = GetComponent <Moveable>(); if (moveable) { moveableData = moveable.SaveData(moveableData); } return(Serializer.SaveScriptData <MoveableData> (moveableData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { TimelineData timelineData = new TimelineData(); timelineData.objectID = constantID; timelineData.savePrevented = savePrevented; #if UNITY_2017_1_OR_NEWER PlayableDirector director = GetComponent <PlayableDirector>(); timelineData.isPlaying = (director.state == PlayState.Playing); timelineData.currentTime = director.time; #else ACDebug.LogWarning("The 'Remember Director' component is only compatible with Unity 5.6 onward.", this); #endif return(Serializer.SaveScriptData <TimelineData> (timelineData)); }
public override string SaveData() { AnimatorData animatorData = new AnimatorData(); animatorData.objectID = constantID; animatorData.savePrevented = savePrevented; if (saveController && _animator.runtimeAnimatorController != null) { animatorData.controllerID = AssetLoader.GetAssetInstanceID(_animator.runtimeAnimatorController); } animatorData.parameterData = ParameterValuesToString(Animator.parameters); animatorData.layerWeightData = LayerWeightsToString(); animatorData.stateData = StatesToString(); return(Serializer.SaveScriptData <AnimatorData> (animatorData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { HotspotData hotspotData = new HotspotData(); hotspotData.objectID = constantID; hotspotData.savePrevented = savePrevented; if (OwnHotspot) { hotspotData.isOn = OwnHotspot.IsOn(); hotspotData.buttonStates = ButtonStatesToString(OwnHotspot); hotspotData.hotspotName = OwnHotspot.GetName(0); hotspotData.displayLineID = OwnHotspot.displayLineID; } return(Serializer.SaveScriptData <HotspotData> (hotspotData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { ColliderData colliderData = new ColliderData(); colliderData.objectID = constantID; colliderData.isOn = false; if (GetComponent <Collider>()) { colliderData.isOn = GetComponent <Collider>().enabled; } else if (GetComponent <Collider2D>()) { colliderData.isOn = GetComponent <Collider2D>().enabled; } return(Serializer.SaveScriptData <ColliderData> (colliderData)); }
public override string SaveData() { ActionList actionList = GetComponent <ActionList>(); if (actionList == null) { return(string.Empty); } ActionListParamData data = new ActionListParamData(); data.objectID = constantID; data.savePrevented = savePrevented; data.paramData = actionList.GetParameterData(); return(Serializer.SaveScriptData <ActionListParamData> (data)); }
public override string SaveData() { ParticleSystemData particleSystemData = new ParticleSystemData(); particleSystemData.objectID = constantID; particleSystemData.savePrevented = savePrevented; ParticleSystem particleSystem = GetComponent <ParticleSystem>(); if (particleSystem != null) { particleSystemData.isPlaying = particleSystem.isPlaying; particleSystemData.isPaused = particleSystem.isPaused; particleSystemData.currentTime = particleSystem.time; } return(Serializer.SaveScriptData <ShapeableData> (particleSystemData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { ContainerData containerData = new ContainerData(); containerData.objectID = constantID; containerData.savePrevented = savePrevented; if (_Container) { containerData.collectionData = _Container.InvCollection.GetSaveData(); containerData._linkedIDs = string.Empty; // Now deprecated containerData._counts = string.Empty; // Now deprecated containerData._IDs = string.Empty; // Now deprecated } return(Serializer.SaveScriptData <ContainerData> (containerData)); }
/** * <summary>Serialises appropriate GameObject values into a string.</summary> * <returns>The data, serialised as a string</returns> */ public override string SaveData() { MaterialData materialData = new MaterialData(); materialData.objectID = constantID; List <string> materialIDs = new List <string>(); Material[] mats = GetComponent <Renderer>().materials; foreach (Material material in mats) { materialIDs.Add(AssetLoader.GetAssetInstanceID(material)); } materialData._materialIDs = ArrayToString <string> (materialIDs.ToArray()); return(Serializer.SaveScriptData <MaterialData> (materialData)); }