Interfaces

Lightweight interfaces that game entities implement to participate in the Possession System. Each interface exposes a single property providing access to the underlying Possessor or Possessable MonoBehaviour, and pairs with extension methods for a clean API.

Architecture

spinner

Key Concept

The interfaces follow the component bridge pattern: game classes (e.g., Player, Character) implement IPossessor or IPossessable and return their companion MonoBehaviour. Extension methods in the Extensions folder then delegate through this property, so callers never need to know about the underlying components.

// Game class implements the interface
public class Player : MonoBehaviour, IPossessor
{
    [SerializeField] private Possessor possessor;
    public Possessor Possessor => possessor;
}

// Callers use extension methods on the interface
player.Possess(npc);       // PossessorExtensions
npc.IsPossessedBy<Player>(); // PossessableExtensions

Classes

Interface
Description

Marks an entity as possessable and exposes Possessable

IPossessor

Marks an entity as a possessor and exposes Possessor

Last updated