public class JumpAbility : IAbility { public void UseAbility() { //Code to initiate a jump } } public class Character { public ListAbilities { get; set; } public Character() { //Add the jump ability to the character's list of abilities Abilities.Add(new JumpAbility()); } }
public class FireAbility : IAbility { public void UseAbility() { //Code to emit fire } } public class Character { public ListThe AddAbility unit is often included in game development libraries such as Unity or Unreal Engine.Abilities { get; set; } public Character() { //Add the fire ability to the character's list of abilities Abilities.Add(new FireAbility()); } }