private void setReleaseMultiplier(EffectContext context) {
var currentMove = this.GetCurrentMove();
if (currentMove == null) {
return;
}
Transform caster = context.Caster;
Animator animator = caster.gameObject.GetComponentInChildren<Animator>();
var currentAnimationState = animator.GetCurrentAnimatorStateInfo(0);
var posInAnimation = currentAnimationState.normalizedTime;
Debug.Log($"posInAnimation {posInAnimation}");
float positionalReleaseMultiplier = 1f;
if ((currentMove.StartReleaseNormalized < posInAnimation) && (posInAnimation < currentMove.EndReleaseNormalized)) {
// this means we're in the maximal release section
positionalReleaseMultiplier = 1f;
} else if (posInAnimation < currentMove.StartReleaseNormalized) {
// otherwise, get a partial bonus in reletaion to how close we are to the relese
positionalReleaseMultiplier = posInAnimation/currentMove.StartReleaseNormalized;
} else if (currentMove.EndReleaseNormalized < posInAnimation) {
// otherwise, get a partial bonus in reletaion to how far we are from the release
positionalReleaseMultiplier = (1-posInAnimation)/(1-currentMove.EndReleaseNormalized);
}
Debug.Log($"positionalReleaseMultiplier {positionalReleaseMultiplier}");
context.ReleaseMultiplier = new() {
MatchingAoe = currentMove.MatchingAoe,
MatchingAoeReleaseMultiplier = currentMove.MatchingAoeReleaseMultiplier * positionalReleaseMultiplier,
NonMatchingAoeReleaseMultiplier = currentMove.NonMatchingAoeReleaseMultiplier * positionalReleaseMultiplier,
};
}