/// <summary> /// Store information about a single animation parameter. /// </summary> /// <param name="param">The animation parameter to store.</param> private void StoreParameter(AnimatorControllerParameter param) { string key = guid.ToString() + "_" + param.name; dynamic value = null; // Set the value based on the parameter type. switch (param.type) { case AnimatorControllerParameterType.Int: { key += Keys.ANIM_INT; value = anim.GetInteger(param.name); break; } case AnimatorControllerParameterType.Bool: { key += Keys.ANIM_BOOL; value = anim.GetBool(param.name); break; } case AnimatorControllerParameterType.Float: { key += Keys.ANIM_FLOAT; value = anim.GetFloat(param.name); break; } default: return; // Triggers fire one off. They don't need to be stored. } if (value != null) { VSave.Set(StaticFolders.ANIMATION, key, value); } }
/// <summary> /// Store the animator's state. /// </summary> public void Store() { string key = guid.ToString() + Keys.PARTICLES_ENABLED; bool value = isEmitting; VSave.Set(StaticFolders.ANIMATION, key, value); }
//------------------------------------------------------------------------- // Storable API //------------------------------------------------------------------------- public void Store() { string folder = StaticFolders.BEHAVIOR; string key = guid.ToString() + Keys.SOLVED; VSave.Set(folder, key, solved); }
/// <summary> /// Store the animator's state. /// </summary> private void StoreState() { int hash = curState.fullPathHash; string key = guid.ToString() + Keys.ANIM_STATE; string folder = StaticFolders.ANIMATION; VSave.Set(folder, key, hash); }
//------------------------------------------------------------------------- // Storable API //------------------------------------------------------------------------- public void Store() { string folder = StaticFolders.ANIMATION; string key = guid.ToString() + Keys.POSITION; float[] values = new float[] { transform.position.x, transform.position.y, transform.position.z }; VSave.Set(folder, key, values); }
//------------------------------------------------------------------------- // Storable API //------------------------------------------------------------------------- /// <summary> /// Store whether or not each component on the object is enabled. /// </summary> public void Store() { List <bool> enabledList = new List <bool>(); foreach (MonoBehaviour comp in ComponentsToTrack) { enabledList.Add(comp.enabled); } VSave.Set(StaticFolders.BEHAVIOR, keys, enabledList); }
//------------------------------------------------------------------------- // Collectible API //------------------------------------------------------------------------- public override void OnCollected() { base.OnCollected(); if (!string.IsNullOrEmpty(key)) { VSave.Set(StaticFolders.PEOPLE, key, true); DisableComponents(); } else { Debug.LogWarning("Lost person \"" + name + "\" is missing the name property! Collection not saved!"); } }
/// <summary> /// Mark this object as permanently destroyed. This means the object won't /// respawn when you return to the scene. /// </summary> public void KeepDestroyed() { VSave.Set(StaticFolders.DESTRUCTIBLE, guid + Keys.KEEP_DESTROYED, true); }
//------------------------------------------------------------------------- // Storable API //------------------------------------------------------------------------- public void Store() { VSave.Set(StaticFolders.DIALOGS, Target.ToString() + Keys.CURRENT_DIALOG, Dialog.ToByteArray()); }
/// <summary> /// Store the active status of a single game object. /// </summary> /// <param name="guid">The global ID of the game object to store.</param> private void StoreObject(string key) { VSave.Set(StaticFolders.BEHAVIOR, key, trackedObjects[key]); }