How would you do it if the player and enemies have separate damage calculation? Should I make a separate health component? For example, the player has an armor value that reduces the damage, but the enemies may not have armor, so they would have separate damage. Can I just use different events where the enemies call a different event?
@andaronКүн бұрын
You can simply on AnyDamage event -> pass value to "calculateDamage" custom function and it spit out calculated damage. Use event dispatcher, bind that dispatcher inside your component and you have reduced damage
@rshad4everКүн бұрын
I hate actor components, casting is nightmare
@thegamedevcaveКүн бұрын
I dont think anything about using actor components really inherently requires casting so something else might be going wrong in your workflow. Matter of fact, the nice thing is that you can set up an interface for getting any kind of actor component and retrieve it from any actor without the need to cast if you're often accessing other actor's components. (like an inventory component for instance)
@Captainpanda20803 сағат бұрын
Like he said, something is off with your workflow. Actor components are incredibly easy to work with. If you want to access the owner of the component you can use get owner, use and interface to retrieve functions. If you want to get the component in another actor, you can use get component by tag, get component by interface. Etc.