public void Gather(GameObject model, RaycastHit hit, SkillsController skillsController) { model.GetComponent <Animator> ().SetTrigger("punching"); ResourceCapsule rc = hit.transform.gameObject.GetComponent <ResourceCapsule> (); if (rc) { Debug.Log("Attempting Harvest"); SkillTree playerSkillTree = skillsController.skilltrees.Where(x => x.skillTreeName == rc.requiredAbility.parentSkillTree.skillTreeName && x.abilities.Contains(rc.requiredAbility)).Single(); SkillTreeAbility playerAbility = playerSkillTree.abilities.Where(x => x.abilityName == rc.requiredAbility.abilityName).Single(); if (playerAbility.unlocked) { Debug.Log("Has sufficient skiiiiil"); playerSkillTree.AddExp(playerAbility.rate); GatherFromCapsule(hit.transform.gameObject.GetComponent <ResourceCapsule> (), playerAbility.rate); } else { Debug.Log("Cant harvest from this yet... Dummy"); } } }