#if INVECTOR_PLAYABLESANIMATOR using InvectorCore.Playables; using UnityEngine; namespace Invector.vMelee { /// /// PlayablesAnimator counterpart of . Rolls the attack index /// on state enter and stores it on , whose /// RandomAttack member the PDM rows read as a condition. /// public class vRandomAttackBehaviourPDM : PlayablesStateBehaviour { public int attackCount; public override void OnStateEnter(in PlayablesStateContext context) { if (context.Animator == null) return; vPlayablesRandomAttack holder = context.Animator.GetComponent(); if (holder == null) { Debug.LogWarning( $"{nameof(vRandomAttackBehaviourPDM)} needs a {nameof(vPlayablesRandomAttack)} " + $"on '{context.Animator.name}' to publish the rolled index.", context.Animator); return; } holder.Roll(attackCount); } } } #endif