So, overall, writing Abilities from scratch is a lot of work, so ideally it'd be better to extend and overwrite similar abilities (for example, Height Change if you were to make a shrink/growth ability).
I've had luck with this in some cases, but this latest time, I've been hitting a number of roadblocks.
Problem 1: Hidden requirements. Example: Interact Ability requiring a "MoveTowardsLocation" component.
Problem 2: Unextendable classes.
Calls in Interact.cs
Which fails because you cannot assign type of MyInteractClassExtension to m_Interactable
Then, the ability never starts because MoveTowardsLocation isn't found.
UltimateCharacterLocomotion.cs
Problem 3: Appearance in inspector of control, but is actually hardcoded
The reason I'm trying to overwrite Interact in the first place is because I was NOT wanting the interact ability to automatically end after the animation complete event (which fires after the first loop, even if the animation continues looping).
```m_InteractCompleteEvent.RegisterUnregisterAnimationEvent(true, m_GameObject, "OnAnimatorInteractComplete", InteractComplete);```
Which took me awhile to figure out because the Ability "Stop Type" menu/variable was still exposed, and the stop event bool under "Interact" is basically unreachable because of line 287 of Interact.CS calling StopAbility();
Desired changes:
1. Use interfaces for variables if it makes sense a class may be extended. Especially in the above case.
2. Change interact (and other abilities working similarly), so that "Animation Event" is a Stop Type and only used if that Stop Type is selected.
3. I'm aware there's bools in "Interact Event" but I would move the animation event to the ability level to unify it with start and stop types and also because animations are going to be used in most abilities.
Let me know if any further clarifications are needed.
I've had luck with this in some cases, but this latest time, I've been hitting a number of roadblocks.
Problem 1: Hidden requirements. Example: Interact Ability requiring a "MoveTowardsLocation" component.
Problem 2: Unextendable classes.
public class MyInteractExtentsion : Interact
Calls in Interact.cs
public override MoveTowardsLocation[] GetMoveTowardsLocations()
{
if (m_Interactable.gameObject.GetCachedComponents<MoveTowardsLocation>() != null)
return m_Interactable.gameObject.GetCachedComponents<MoveTowardsLocation>();
else
return null;
}
Which fails because you cannot assign type of MyInteractClassExtension to m_Interactable
Then, the ability never starts because MoveTowardsLocation isn't found.
UltimateCharacterLocomotion.cs
898: if (m_MoveTowardsAbility.StartMoving(ability.GetMoveTowardsLocations(), ability))
Problem 3: Appearance in inspector of control, but is actually hardcoded
The reason I'm trying to overwrite Interact in the first place is because I was NOT wanting the interact ability to automatically end after the animation complete event (which fires after the first loop, even if the animation continues looping).
```m_InteractCompleteEvent.RegisterUnregisterAnimationEvent(true, m_GameObject, "OnAnimatorInteractComplete", InteractComplete);```
Which took me awhile to figure out because the Ability "Stop Type" menu/variable was still exposed, and the stop event bool under "Interact" is basically unreachable because of line 287 of Interact.CS calling StopAbility();
Desired changes:
1. Use interfaces for variables if it makes sense a class may be extended. Especially in the above case.
2. Change interact (and other abilities working similarly), so that "Animation Event" is a Stop Type and only used if that Stop Type is selected.
3. I'm aware there's bools in "Interact Event" but I would move the animation event to the ability level to unify it with start and stop types and also because animations are going to be used in most abilities.
Let me know if any further clarifications are needed.