void ModifyHostileStats(InputParent ip) { float totalDamage = damage - ip.states.rpg.GetDefence(); if (totalDamage < 0) { totalDamage = 0; } bool hasHitShield = false; EquippableShield equippableShield = ip.states.rpg.currentShield; if (equippableShield != null) { if (equippableShield.shieldScript.gameObject.activeSelf) { float angle = Vector3.SignedAngle(ip.transform.forward, ownerForward, Vector3.up); //Debug.Log(angle); if (angle > 90 || angle < -90) { //isHit = true; hasHitShield = true; particle = "Blue Sparks(Clone)"; if (equippableShield.shieldScript.parryWindow) { if (wielder != null) { wielder.animator.CrossFade("Stagger", 0.15f); } } else { ip.states.rpg.stamina.ModifyCur(-totalDamage * 1.75f); } } } } if (!ip.states.isDodge && !hasHitShield /* && !isHit*/) { ip.states.Hurt(totalDamage); particle = totalDamage == 0 ? "Blue Sparks(Clone)" : "Blood(Clone)"; if (totalDamage == 0) { if (wielder != null) { wielder.animator.CrossFade("Stagger", 0.15f); } } if (ip.ui != null) { if (!ip.ui.activeSelf) { ip.StartCoroutine(ip.ShowUI()); } } } }
private void SettleWeaponEquipment() { if (!Input.GetKeyDown(KeyCode.Z)) { return; } if (states.rpg.generalStuff.Count != 0) { IAttackable weapon = states.rpg.generalStuff[0].GetComponent <IAttackable>(); if (weapon != null) { states.rpg.generalStuff.RemoveAt(0); states.rpg.weapons.Add(weapon); } else { EquippableShield shield = states.rpg.generalStuff[0].GetComponent <EquippableShield>(); if (shield != null) { states.rpg.generalStuff.RemoveAt(0); states.rpg.shields.Add(shield); } } } if (rpg.weapons.Count != 0) { if (rpg.currentWeapon == null) { rpg.currentWeapon = rpg.weapons[0]; rpg.currentWeapon.Equip(states.aem); rpg.weapons.RemoveAt(0); } } if (rpg.shields.Count != 0) { if (rpg.currentShield == null) { rpg.currentShield = rpg.shields[0]; rpg.currentShield.Equip(states.aem); rpg.shields.RemoveAt(0); } } if (rpg.currentWeapon != null) { if (rpg.currentWeapon.Type == "Bow" && rpg.currentShield != null) { EquippableShield temp = rpg.currentShield; rpg.currentShield.Unequip(); temp.PickUp(states); } } // Drop Weapon if (Input.GetKeyDown(KeyCode.X)) { if (rpg.currentWeapon != null) { rpg.currentWeapon.Unequip(); } if (rpg.currentShield != null) { rpg.currentShield.Unequip(); } } }