private static void CheckRepeatedCharacter(Character character, Options options, List <Character> characters) { bool canAdd = true; foreach (string characterName in options.characterList) { if (characterName == character.name) { canAdd = false; break; } } if (canAdd) { characters.Add(character); if (characters.Count == 1) { options.playerCharacterName = character.name; } options.characterList = ArrayHelper.Add(options.characterList, character.name); OptionsController.Save(options, options.jsonPrettyPrint); JSONHelper.Create(character, character.name, options.jsonPrettyPrint, "Diplomata/Characters/"); } else { Debug.LogError("This name already exists!"); } }
private static void CheckRepeatedInteractable(Interactable interactable, Options options, List <Interactable> interactables) { bool canAdd = true; foreach (string interactableName in options.interactableList) { if (interactableName == interactable.name) { canAdd = false; break; } } if (canAdd) { interactables.Add(interactable); options.interactableList = ArrayHelper.Add(options.interactableList, interactable.name); OptionsController.Save(options, options.jsonPrettyPrint); JSONHelper.Create(interactable, interactable.name, options.jsonPrettyPrint, "Diplomata/Interactables/"); } else { Debug.LogError("This name already exists!"); } }