public class HealthComponent : AddonComponent { public int healthPoints { get; set; } public HealthComponent(Item item) : base(item) { // constructor logic healthPoints = 100; } }
public class SoundEffectComponent : AddonComponent { private AudioSource audioSource; public SoundEffectComponent(Item item) : base(item) { // constructor logic audioSource = item.AddComponentIn this example, a new component called "SoundEffectComponent" is created that extends the AddonComponent class. This component provides a PlaySoundEffect method that can be used to trigger a sound effect when a button is clicked. Package library: The Server.Items AddonComponent is part of the Server package library in C#.(); } public void PlaySoundEffect() { audioSource.Play(); } }