/// <summary> /// Listens for the OnRecordPersistentData message and records the current bark index. /// </summary> public void OnRecordPersistentData() { if (enabled && barkHistory != null) { DialogueLua.SetActorField(GetBarkerName(), "Bark_Index", barkHistory.index); } }
/// <summary> /// Listens for the OnRecordPersistentData message and records the current bark index. /// </summary> public void OnRecordPersistentData() { if (enabled && !string.IsNullOrEmpty(barkConversation)) { DialogueLua.SetActorField(GetBarkerName(), "Bark_Index", barkHistory.index); } }
/// <summary> /// Listens for the OnRecordPersistentData message and records the game object's position /// and rotation into the Lua Actor[] table. /// </summary> public void OnRecordPersistentData() { string positionString = GetPositionString(); DialogueLua.SetActorField(actorName, "Position", positionString); if (recordCurrentLevel) { DialogueLua.SetActorField(actorName, "Position_" + Application.loadedLevelName, positionString); } }
/// <summary> /// Listens for the OnRecordPersistentData message and records the game object's position /// and rotation into the Lua Actor[] table. /// </summary> public void OnRecordPersistentData() { string positionString = GetPositionString(); var fieldName = recordCurrentLevel ? "Position_" + SanitizeLevelName(Tools.loadedLevelName) : "Position"; if (DialogueDebug.logInfo) { Debug.Log("Dialogue System: Persistent Position Data Actor[" + actorName + "]." + fieldName + "='" + positionString + "'", this); } DialogueLua.SetActorField(actorName, fieldName, positionString); }
/// <summary> /// Listens for the OnApplyPersistentData message and retrieves the game object's position /// and rotation from the Lua Actor[] table. /// </summary> public void OnApplyPersistentData() { string spawnpointName = DialogueLua.GetActorField(actorName, "Spawnpoint").asString; if (!string.IsNullOrEmpty(spawnpointName)) { var spawnpoint = Tools.GameObjectHardFind(spawnpointName); if (spawnpoint == null) { if (DialogueDebug.logWarnings) { Debug.LogWarning("Dialogue System: Persistent Position Data found Actor[" + actorName + "].Spawnpoint value '" + spawnpointName + "' but can't find a GameObject with this name in the scene. Moving actor to saved position instead.", this); } } else { transform.position = spawnpoint.transform.position; transform.rotation = spawnpoint.transform.rotation; if (DialogueDebug.logInfo) { Debug.Log("Dialogue System: Persistent Position Data spawning " + actorName + " at spawnpoint " + spawnpoint, this); } } DialogueLua.SetActorField(actorName, "Spawnpoint", string.Empty); if (spawnpoint != null) { return; } } var fieldName = recordCurrentLevel ? "Position_" + SanitizeLevelName(Tools.loadedLevelName) : "Position"; var positionString = DialogueLua.GetActorField(actorName, fieldName).asString; if (!string.IsNullOrEmpty(positionString)) { if (DialogueDebug.logInfo) { Debug.Log("Dialogue System: Persistent Position Data restoring " + actorName + " to position " + positionString, this); } ApplyPositionString(positionString); } else { if (DialogueDebug.logInfo) { Debug.Log("Dialogue System: Persistent Position Data Actor[" + actorName + "]." + fieldName + " is blank. Not moving " + actorName, this); } } }