public ISpellComponent LoadComponent(UnLoadedSpellComponent spellUnLoaded) { string localPath = Path.Combine(path, spellUnLoaded.type.ToString()); localPath = Path.Combine(localPath, spellUnLoaded.name + ".json"); string json = File.ReadAllText(localPath); switch (spellUnLoaded.type) { case SpellComponent.SubSpellComponentType.Paper: SpellPage page = JsonUtility.FromJson <SpellPage>(json); return(page); case SpellComponent.SubSpellComponentType.Rune: SpellRune rune = JsonUtility.FromJson <SpellRune>(json); return(rune); case SpellComponent.SubSpellComponentType.language: Language lang = JsonUtility.FromJson <Language>(json); return(lang); case SpellComponent.SubSpellComponentType.Ink: Ink ink = JsonUtility.FromJson <Ink>(json); return(ink); default: return(null); } }
void RuneChanged(string rune) { SpellRune spellRune = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent(rune, SpellComponent.SubSpellComponentType.Rune)) as SpellRune; Debug.Log(spellRune.GetTitle() + "RUNE NAME"); projSpellBookBuilder.SetRune(spellRune); }
// Otros métodos publicos /// <summary> /// Añade una runa al hechizo actual /// </summary> /// <param name="rune">Runa a añadir</param> public static void AddRune(SpellRune.Rune rune) { instance._spell.Add(rune); }