private IEnumerator ParryRoutine() { AttackIndictator attackIndicator = characterComponents.attackIndicator; yield return(timestamps.GetNextWait(0)); //parry start characterComponents.characterSheet.AddEffect(useEffect); characterComponents.characterSheet.AddAttackListener(this); attackIndicator.EnableBlockIndicator(blockConfig.blockAngle); yield return(timestamps.GetNextWait(1)); //parry end EndParry(false); yield return(timestamps.GetNextWait(2)); //ability end EndAbility(); }
public static void BlockAttack( AttackIndictator attackIndicator, BlockConfig block, int damage, Vector3 contactPoint, out DefenceFeedback feedback) { Vector3 contactDirection = contactPoint - attackIndicator.transform.position; float angle = Vector3.Angle(contactDirection, attackIndicator.blockIndicator.transform.forward); if (angle <= block.blockAngle) { attackIndicator.SetLastHit(contactDirection.normalized, true); feedback = new DefenceFeedback( true, block.ricochet, Mathf.RoundToInt(damage * block.damageReduction), block.poise); } else { attackIndicator.SetLastHit(contactDirection.normalized, false); feedback = DefenceFeedback.NoDefence; } }