// Use this for initialization void Awake() { Character loadedCharacter; if (dbCharacter != "") { CharacterDB cdb = Resources.Load <CharacterDB>("CharacterDB"); loadedCharacter = cdb.GetCharacter(dbCharacter); } else if (rosterCharacter != "") { // get a character from the roster loadedCharacter = UnitRoster.Instance.GetCharacter(rosterCharacter); } else { // use preset character Debug.LogWarning("Prefferably load from roster or database instead of hardcoding a character here. "); loadedCharacter = presetCharacter; presetCharacter.Skilltree = SkillTreeDB.GetSkillTreeClone("Empty"); presetCharacter.Sprite = GetComponent <SpriteRenderer>().sprite; } if (setLevel > 0) { loadedCharacter.Level = setLevel; } GetComponent <Unit>().Character = loadedCharacter; }
private void UpdateUIScript() { if (DatabaseHandler.requestCharacter) { DatabaseHandler.character = CharacterDB.GetCharacter(); DatabaseHandler.requestCharacter = false; } if (DatabaseHandler.requestCharacterInventory) { DatabaseHandler.characterInventory = InventoryDB.GetCharacterInventory(); DatabaseHandler.requestCharacterInventory = false; } }
public Character getBaseCharacter(string name) { return(StarterDatabase.GetCharacter(name)); }