API & Integration with ABC
ABC IEntity
ABC IEntity is a static class which sits in the middle of all core components of ABC holding information regarding the entity. It acts as a bridge between the core components for communication and function calling, similar to an API. It also architecturally is used to store a lot of reference points to save on performance.
Using ABC IEntity's API
This class can also be used as an API to execute ABC functions and features from your own scripts like triggering an ability or equipping a weapon. To use the API simply execute the following code from anywhere in your own scripts:
Overriding ABC IEntity (Plugging in your own systems)
This class can also be extended and overriden to plug in your own systems or modify the base code that comes with ABC.
An example of this is if you want to use your own health management system instead of ABC's system. To do this you can override the AdjustHealth method so that anytime ABC calls this class to reduce health (like from an ability effect) it will instead run your override code and call your own component replacing ABC's original function.
Effect Subscriber Component
A script component is available named ABC EffectEventSubscriber which will allow for you to easily integrate other components when effects are applied and/or removed. When an entity is inflicted by a certain effect you can link that to call other methods in your own scripts.
Setting up the Effect Subscriber
1. Add the ABC_EffectEventSubscriber component to the entity which will listen for effects applied to itself.
2. Change the size of the Custom Effect Events or Custom Effect Removal Events. Each increment allows for an extra custom effect to listen out for.
3. Enter the name of the Effect you want the subscriber to listen for in the "Effect Name" text box
4. Add a Unity Event by pressing the "+" button. The Unity Event we are about to setup here will determine what function(s) to call once the custom effect defined in step 3 is added/removed.
5. Find and select the GameObject which holds the component and the method you wish to invoke when the custom effect is added and or removed. Once the Gameobject is selected drag it into the box below the "Runtime Only" dropdown.
This GameObject does not have to be the same entity that has the subscriber component attached, so it is possible to have an entity which just listens out for certain effects which then runs methods on other Objects.
6. Once the GameObject has been inserted the dropdown to the right of the "Runtime Only" dropdown will become avaliable enabling you to selection the function which will run.
7. Setup has been completed. Now the function selected will be called every time the entity with the ABC EffectEventSubscriber component is inflicted with an Effect that matches the text in the "Effect Name" box.
Last updated
Was this helpful?