There is an abstract Creature class from which two classes are inherited: Rogue, Goblin (in these classes there are a couple of skills and stats). There is a class Fight (it implements the choice of skills and their use) which is inherited from Monobehaviour. In general, I want to make a skill that, if successfully triggered, will admit the enemy every turn, with the ability to naskatyvat effect, but I can not figure out how to implement it. I understand that you need to do an event in a fight and subscribe to it from the classes of creatures. I create an event in the Fight class, but in the Goblin / Rogue classes I cannot subscribe to it because it is not visible. If you make an event in the parent Creature class, then I cannot declare an event in the Fight class. How damn this poison to implement?))

    1 answer 1

    • Highlight health in a separate component with which all classes work. This will standardize the handling of damage / heal / buffs / debuffs.
    • Select the effect handler in a separate component, it will work with health, and process all that is hung on the creature, taking into account the time.
    • Add an effect, a poison that can be passed to an effect handler, on any creature.

    This is a general scheme, the details are very dependent on architecture, genre, and so on.

    • The answer seems logical, but I don’t understand much, for example: what is a component and how to put health into it, what is an effect handler and how to create it. At leisure, I will try to google how to implement all these points =) Many thanks for the answer =) - Oleg It does not matter