public override void HandleAnimationEvent(AnimationEventRepeater.AnimationEventArgs eventArgs) { int newStateIndex = eventArgs.intValue; // Only when changing animation states if (newStateIndex != _animationState) { if (_colliderGroups[newStateIndex] != null) { _colliderGroups[_animationState].gameObject.SetActive(false); _colliderGroups[newStateIndex].gameObject.SetActive(true); _animationState = newStateIndex; } else { Debug.LogError("Accesing collider group at index " + newStateIndex + " that does not exist"); } } }
// Override methods // Note that this method will handle animation changes AFTER the update method for this frame has been called // Any changes to colliders will affect physics for the NEXT FixedUpdate call, and thus the next frame public virtual void HandleAnimationEvent(AnimationEventRepeater.AnimationEventArgs eventArgs) { }