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 : IComponent

Extends: 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.

circle-info

IComponent is a base interface from the Paragon framework. It implies the implementor is a Unity component (MonoBehaviour) with standard Unity lifecycle.

Quick Lookup

Goal
How

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:

  1. Have a Possessable MonoBehaviour on the same GameObject (or accessible)

  2. Return it from the Possessable property

  3. Ensure the implementing class is also a MonoBehaviour (required by IComponent)

You SHOULD:

  • Use [SerializeField] or GetComponent<Possessable>() to obtain the reference

  • Implement the interface on the primary game class (e.g., Character, Vehicle) for clean external API

Common Pitfalls

circle-exclamation
circle-exclamation

Examples

Implementing IPossessable

Using IPossessable for Type Queries

See Also

Last updated