Esempio n. 1
0
        public void Serialise(BinaryWriter writer)
        {
#if UNITY_EDITOR
            if (string.IsNullOrEmpty(guid))
            {
                guid = GUID.Generate().ToString();
                EditorUtility.SetDirty(this);
            }

            //Will only add the scriptable if it's not already been added
            NarrativeDictionary.GetAsset().AddAction(this);
#endif //UNITY_EDITOR

            writer.Write(guid);
        }
Esempio n. 2
0
        public static Action Deserialise(BinaryReader reader)
        {
            string uid    = reader.ReadString();
            Action action = NarrativeDictionary.GetAsset().GetAction(uid);

            if (action == null)
            {
                return(null);
            }

            foreach (WorldPropertyScriptable prop in action.ExitConditions)
            {
                action._runtimeExitConditions.Add(prop.GetRuntimeProperty());
            }

            foreach (WorldPropertyScriptable precondition in action.Preconditions)
            {
                action.RuntimePreconditions.Add(precondition.GetRuntimeProperty());
            }

            return(action);
        }
Esempio n. 3
0
 public static WorldPropertyScriptable Deserialise(BinaryReader reader)
 {
     return(NarrativeDictionary.GetAsset().GetWorldProperty(reader.ReadString()));
 }