Do we still need to listen to UnitActionSystem.OnActionStarted?

It seems like once we created the Unit.OnAnyActionPointsChanged event we no longer need to listen to the OnActionStarted event on UnitActionSystem. It seems redundant. Am I missing some other use case?

1 Like

I haven’t cracked open my project, but as far as I remember action points change when an action was taken. I can take several actions in my turn, so my turn does not end when I’ve taken an action.

I would have to open my project to refresh my memory a bit

Edit Had a look and I remembered it correctly. The OnAnyActionPointsChanged fires whenever action points changed. It doesn’t indicate that a turn has changed.

As for the title (which is not mentioned in the question) UnitActionSystem.OnActionStarted can actually be removed (at least from my code) because nothing is listening to it anymore. It doesn’t matter that it’s there, though, because it won’t fire if nothing is listening to it.

1 Like

I meant to say UnitActionSystem.OnActionStarted. However, looking at UnitActionSystemUI it seems like listening to UnityActionSystem.OnActionStarted, TurnSystem.OnTurnChanged, and Unit.OnAnyActionPointsChanged are all redundant. Unit.TrySpendActionPointsToTakeAction fires OnAnyActionPointsChanged which covers the OnActionStarted event and Unit listens to OnTurnChanged and fires OnAnyActionPointsChanged which covers UnitActionSystemUI listening to OnTurnChanged itself.

1 Like

Privacy & Terms