// Use this for initialization void Start() { CanManaHeal = true; CanSwing = true; CanDodge = true; CanTp = true; DontDestroyOnLoad(gameObject); speed = 12; defaultspeed = 12; StartCoroutine(WalkFrame()); Switcher = GameObject.FindGameObjectWithTag("Loader"); StartCoroutine(HealTick()); StartCoroutine(ManaTick()); StartCoroutine(CombatTick()); StartCoroutine(SkillTick()); ItemManager = GameObject.FindGameObjectWithTag("ItemManager").GetComponent <ItemManager>(); Music = GameObject.FindGameObjectWithTag("Audio").GetComponent <MusicScript>(); SkillUi = GameObject.FindGameObjectWithTag("SkillUi").GetComponent <SkillUIScript>(); AddEquipped(ItemManager.registereditems[3]); codeindex = 0; if (ExpMaxes[Mathf.Clamp(Level - 1, 0, 250)] != 0) { ExpMax = ExpMaxes[Mathf.Clamp(Level - 1, 0, 250)]; } else { ExpMax = 1000 + (500 * Level); } Health = MaxHealth; Mana = MaxMana; }
public void Save() { file = File.Create(path); hero = GameObject.FindGameObjectWithTag("Hero").GetComponent <HeroScript>(); if (hero != null) { save.inventory = hero.inventory; save.Gold = hero.gold; save.MaxHealth = hero.MaxHealth; save.MaxMana = hero.MaxMana; save.Level = hero.Level; save.Exp = hero.Exp; save.SkillPoints = hero.SkillPoints; save.Scene = loader.currscene; save.PlayerX = hero.gameObject.transform.position.x; save.PlayerY = hero.gameObject.transform.position.y; } skillui = GameObject.FindGameObjectWithTag("SkillUi").GetComponent <SkillUIScript>(); if (skillui != null) { save.skills = skillui.skills; } bf.Serialize(file, save); file.Close(); }
public void Load() { if (!File.Exists(path)) { file = File.Create(path); save.Scene = 12; save.PlayerX = -6; save.PlayerY = -2.36f; bf.Serialize(file, save); } else { file = File.Open(path, FileMode.Open); save = (Save)bf.Deserialize(file); hero = GameObject.FindGameObjectWithTag("Hero").GetComponent <HeroScript>(); if (hero != null) { hero.inventory = save.inventory; hero.gold = save.Gold; hero.MaxHealth = save.MaxHealth; hero.MaxMana = save.MaxMana; hero.Level = save.Level; hero.Exp = save.Exp; hero.SkillPoints = save.SkillPoints; loader.SwitchScene(save.Scene); hero.gameObject.transform.position = new Vector3(save.PlayerX, save.PlayerY, 0); } skillui = GameObject.FindGameObjectWithTag("SkillUi").GetComponent <SkillUIScript>(); if (skillui != null) { skillui.skills = save.skills; skillui.UpdateSkillUi(); } } file.Close(); }
// Use this for initialization void Start() { description = GameObject.FindGameObjectWithTag("SkillDescription").GetComponent <Text>(); skillmanager = GameObject.FindGameObjectWithTag("SkillUi").GetComponent <SkillUIScript>(); }