/** * <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; }
override public float Run() { if (runtimeHotspot == null) { return(0f); } if (interactionType == InteractionType.Use) { if (runtimeHotspot.useButtons.Count > number) { ChangeButton(runtimeHotspot.useButtons [number]); } else { ACDebug.LogWarning("Cannot change Hotspot " + runtimeHotspot.gameObject.name + "'s Use button " + number.ToString() + " because it doesn't exist!", runtimeHotspot); } } else if (interactionType == InteractionType.Examine) { ChangeButton(runtimeHotspot.lookButton); } else if (interactionType == InteractionType.Inventory) { if (runtimeHotspot.invButtons.Count > number) { ChangeButton(runtimeHotspot.invButtons [number]); } else { ACDebug.LogWarning("Cannot change Hotspot " + runtimeHotspot.gameObject.name + "'s Inventory button " + number.ToString() + " because it doesn't exist!", runtimeHotspot); } } runtimeHotspot.ResetMainIcon(); return(0f); }