////////////////////////// // ADD/REMOVE FUNCTIONS // ////////////////////////// /// <summary> /// Adds a skill to the player /// </summary> public void AddSkill(SkillBase _skill) { //Check if player already has the skill if (playerSkills.Contains(_skill)) { return; } //Add skill to player's list of skill playerSkills.Add(_skill); //Update player's skillpoints ModifyCurrentSkillpoints(-_skill.GetSkillpointsNeeded()); //Apply new skill's effect to player _skill.ApplySkillEffect(); }
////////////////////////// // ADD/REMOVE FUNCTIONS // ////////////////////////// /// <summary> /// Adds a skill to the player /// </summary> public void AddSkill(SkillBase _skill) { //Check if player already has the skill if (playerSkills.Contains(_skill)) { Debug.Log("Player already has skill: " + _skill.displayName); return; } //Instantiate scene-based version of skill GameObject skill = (GameObject)Instantiate(Resources.Load("Skills/" + _skill.displayName)); skill.GetComponent <SkillBase>().SetOwner(gameObject); //Set player as skill's owner _skill.SetOwner(gameObject); //Add skill to player's list of skill playerSkills.Add(_skill); //Update player's skillpoints ModifyCurrentSkillpoints(-_skill.GetSkillpointsNeeded()); //Apply new skill's effect to player _skill.ApplySkillEffect(); }