Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CharacterAttribute : Attribute { /* ... */ }
- public enum CharacterAttributeType {
- Health
- }
- public class Character {
- private Dictionary<CharacterAttributeType, CharacterAttribute> attributes;
- public CharacterAttribute GetAttribute (CharacterAttributeType type) {
- return this.attributes[type];
- }
- }
- // Adesso sarà possibile monitorare "la morte del personaggio" in questo modo.
- istanzaPersonaggio.GetAttribute(CharacterAttributeType.Health).OnCurrentChange = (int amount) => {
- if (istanzaPersonaggio.GetAttribute(CharacterAttributeType.Health).Current == 0) {
- /* Morto. */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement