IEnumerator ShowSaveDialogCoroutine(string pathExtension, EntitySaveData entitySaveData) { yield return(FileBrowser.WaitForSaveDialog(false, Application.persistentDataPath + Path.AltDirectorySeparatorChar + pathExtension, "Save File", "Save")); if (FileBrowser.Success) { SavaData.Instance.Save(entitySaveData, FileBrowser.Result); } }
/// <inheritdoc/> public override void Load(SaveData data) { SaveLoadUtils.BasicLoad(this, data); navMeshAgent.Warp(data.pos); sensors.ResetVision(); EntitySaveData entitySaveData = (EntitySaveData)data; if (entitySaveData != null) { hp = entitySaveData.hp; if (Dead != entitySaveData.dead) { if (entitySaveData.dead) { Kill(); } else { Revive(); } Dead = entitySaveData.dead; } switch (entitySaveData.state) { case AIStateAggresion agr: SwitchState(aggresionState); break; case AIStateAttention att: SwitchState(attentionState); break; case AIStateCover cvr: SwitchState(coverState); break; case AIStateIdle idl: SwitchState(idleState); break; case AIStateSleep slp: SwitchState(sleepState); break; } } }
///<inheritdoc/> public override void Load(SaveData data) { SaveLoadUtils.BasicLoad(this, data); EntitySaveData entitySaveData = (EntitySaveData)data; if (entitySaveData != null) { hp = entitySaveData.hp; if (Dead != entitySaveData.dead) { if (entitySaveData.dead) { Kill(); } else { Revive(); } Dead = entitySaveData.dead; } } }
public void ShowSaveDialog(string pathExtension, EntitySaveData entitySaveData) { StartCoroutine(ShowSaveDialogCoroutine(pathExtension, entitySaveData)); }
public void Save(EntitySaveData entitySaveData, string path) { string jsonString = JsonUtility.ToJson(entitySaveData); File.WriteAllText(path, jsonString); }