I'm using Unity to create a game and trying to stick to their component architecture. I'm currently working on adding stats (ie HP, Damage, Armor, etc) to characters. I see three ways to do this through components:
1) A CharacterStatsComponent object that contains just the stats with other components to use them. For example, a TakeDamageComponent that would get the CharacterStatsComponent to get the HP and Armor to use in the damage formula. I like that this separates the stats from the other logic (taking damage, doing damage, movement speed, etc), but not sure if I like having to couple those components.
2) A CharacterLogicComponent (or similiar name) that contains the stats and the logic that uses those stats. This has the advantage of everything being in one place, but also the disadvantage that everything is in one place whether its related or not.
3) The same CharacterStatsComponent as in 1, but instead of characters getting the various logic components (ie TakeDamageComponent) they instead have references to systems (ie TakeDamageSystem) that they pass the CharacterStatsComponent into. It would be similar to 1, but instead of having each character have multiple components there would be a single system they all use.
I am leaning towards 1 or 3, but would like to hear others thoughts and reasoning.
1) A CharacterStatsComponent object that contains just the stats with other components to use them. For example, a TakeDamageComponent that would get the CharacterStatsComponent to get the HP and Armor to use in the damage formula. I like that this separates the stats from the other logic (taking damage, doing damage, movement speed, etc), but not sure if I like having to couple those components.
2) A CharacterLogicComponent (or similiar name) that contains the stats and the logic that uses those stats. This has the advantage of everything being in one place, but also the disadvantage that everything is in one place whether its related or not.
3) The same CharacterStatsComponent as in 1, but instead of characters getting the various logic components (ie TakeDamageComponent) they instead have references to systems (ie TakeDamageSystem) that they pass the CharacterStatsComponent into. It would be similar to 1, but instead of having each character have multiple components there would be a single system they all use.
I am leaning towards 1 or 3, but would like to hear others thoughts and reasoning.