IPossessable
Interface marking a game entity as one that can be possessed. Exposes the underlying Possessable MonoBehaviour, enabling extension methods and allowing the Possession System to query the entity's possession state.
Definition
Namespace: Paragon.Townskeep.PossessionSystem Assembly: Townskeep.dll
public interface IPossessable : IComponentExtends: IComponent
Remarks
IPossessable is one half of the possession interface pair (alongside IPossessor). It follows the component bridge pattern — the implementing class holds a reference to a Possessable MonoBehaviour and exposes it via this interface. The PossessableExtensions class then provides convenience methods (IsPossessed(), GetPossessor(), etc.) that delegate through this property.
The Possessable MonoBehaviour discovers its IPossessable owner via GetComponent<IPossessable>() in Awake(), creating a bidirectional relationship.
IComponent is a base interface from the Paragon framework. It implies the implementor is a Unity component (MonoBehaviour) with standard Unity lifecycle.
Quick Lookup
Implement on a game class
Add IPossessable to class, expose Possessable property
Check possession state
Use extension: possessable.IsPossessed()
Get possessor
Use extension: possessable.GetPossessor()
Type-check possessor
Use extension: possessable.IsPossessedBy<Player>()
Properties
Possessable
The Possessable MonoBehaviour component on this entity.
Implementation Requirements
When implementing IPossessable, you MUST:
Have a
PossessableMonoBehaviour on the same GameObject (or accessible)Return it from the
PossessablepropertyEnsure the implementing class is also a MonoBehaviour (required by
IComponent)
You SHOULD:
Use
[SerializeField]orGetComponent<Possessable>()to obtain the referenceImplement the interface on the primary game class (e.g.,
Character,Vehicle) for clean external API
Common Pitfalls
Missing Possessable component The Possessable MonoBehaviour calls GetComponent<IPossessable>() in Awake() to find its owner. If the implementing class is on a different GameObject, this lookup will fail and Possessable.Owner will be null.
Extension methods require the interface The PossessableExtensions methods extend IPossessable, not Possessable. You must use the interface type for the extensions to be available.
Examples
Implementing IPossessable
Using IPossessable for Type Queries
See Also
Possessable — MonoBehaviour component exposed by this interface
IPossessor — companion interface for possessing entities
PossessableExtensions — convenience methods for this interface
PossessorExtensions — operations that accept
IPossessable
Last updated