private void UpdateSkills() { if (mySkills == null) //need to check for this in case this is called while loading saved parts before default parts are loaded { mySkills = GetComponent <CombatSkills>(); } attackReaction = mySkills.GetAttackReactionSkills(); }
//copies defense skills and gives it to the body DefenseSkills is not public so we use a different struct public AttackReactionSkills GetAttackReactionSkills() { AttackReactionSkills a = new AttackReactionSkills(); float blockMod = 0f; if (body == null) { Start(); } if (!body.PartTooInjured(blockingParts)) { blockMod = blockingParts[0].MyWeapon().hardnessValue; } a.block = mySkillLevels[CombatSkill.Block] + blockMod; a.dodge = mySkillLevels[CombatSkill.Dodge] - blockMod / 2f; a.parry = mySkillLevels[CombatSkill.Parry] - blockMod / 2f; a.will = mySkillLevels[CombatSkill.Willpower]; return(a); }