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)); }
public override void LoadData(string stringData) { HotspotData data = Serializer.LoadScriptData <HotspotData> (stringData); if (data == null) { return; } if (data.isOn) { gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer); } else { gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer); } if (GetComponent <Hotspot>()) { Hotspot _hotspot = GetComponent <Hotspot>(); StringToButtonStates(_hotspot, data.buttonStates); if (data.hotspotName != "") { _hotspot.SetName(data.hotspotName, data.displayLineID); } } }
public void LoadData (HotspotData data) { if (data.isOn) { gameObject.layer = LayerMask.NameToLayer (AdvGame.GetReferences ().settingsManager.hotspotLayer); } else { gameObject.layer = LayerMask.NameToLayer (AdvGame.GetReferences ().settingsManager.deactivatedLayer); } if (GetComponent <Hotspot>()) { StringToButtonStates (GetComponent <Hotspot>(), data.buttonStates); } }
/** * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary> * <param name = "stringData">The data, serialised as a string</param> */ public override void LoadData(string stringData) { HotspotData data = Serializer.LoadScriptData <HotspotData> (stringData); if (data == null) { loadedData = false; return; } SavePrevented = data.savePrevented; if (savePrevented) { return; } if (data.isOn) { gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer); } else { gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer); } if (GetComponent <Hotspot>()) { Hotspot _hotspot = GetComponent <Hotspot>(); if (data.isOn) { _hotspot.TurnOn(); } else { _hotspot.TurnOff(); } StringToButtonStates(_hotspot, data.buttonStates); if (data.hotspotName != "") { _hotspot.SetName(data.hotspotName, data.displayLineID); } _hotspot.ResetMainIcon(); } loadedData = true; }
/** * <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() { HotspotData hotspotData = new HotspotData(); hotspotData.objectID = constantID; if (GetComponent <Hotspot>()) { Hotspot _hotspot = GetComponent <Hotspot>(); hotspotData.isOn = _hotspot.IsOn(); hotspotData.buttonStates = ButtonStatesToString(_hotspot); hotspotData.hotspotName = _hotspot.GetName(0); hotspotData.displayLineID = _hotspot.displayLineID; } return(Serializer.SaveScriptData <HotspotData> (hotspotData)); }
public HotspotData SaveData () { HotspotData hotspotData = new HotspotData (); hotspotData.objectID = constantID; if (gameObject.layer == LayerMask.NameToLayer (AdvGame.GetReferences ().settingsManager.hotspotLayer)) { hotspotData.isOn = true; } else { hotspotData.isOn = false; } if (GetComponent <Hotspot>()) { hotspotData.buttonStates = ButtonStatesToString (GetComponent <Hotspot>()); } return (hotspotData); }
/** * <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); }