PossessorExtensions

Static extension methods for IPossessor that delegate possess/release operations and queries to the underlying Possessor component.

Definition

Namespace: Paragon.Townskeep.PossessionSystem Assembly: Townskeep.dll

public static class PossessorExtensions

Remarks

All methods delegate to IPossessor.Possessor, bridging the high-level IPossessor interface to the concrete Possessor MonoBehaviour. This allows game code to work with interfaces while the Possession System manages the underlying components.

Note that Possess and Release accept IPossessable and internally access .Possessable, so both sides of the operation work at the interface level.

Quick Lookup

Goal
How

Possess a target

possessor.Possess(possessable)

Release a target

possessor.Release(possessable)

Release all

possessor.ReleaseAll()

Check if possessing specific target

possessor.IsPossessing(possessable)

Check if possessing type

possessor.IsPossessing<Character>()

Get specific possession

possessor.TryGetPossession<Character>(out var character)

Methods

Possess

Takes control of the given possessable entity.

Parameter
Type
Description

possessable

IPossessable

The entity to possess

circle-info

Internally calls possessor.Possessor.Possess(possessable.Possessable), triggering the full possess pipeline (actions, events, parenting).

Release

Releases control of the given possessable entity.

Parameter
Type
Description

possessable

IPossessable

The entity to release

TryGetPossession<TPossessable>

Finds a possessed entity whose IPossessable owner is of the given type.

Parameter
Type
Description

possessable

out TPossessable

The typed possession, or null

Returns: true if a possession of the given type was found.

IsPossessing (instance check)

Checks whether the possessor currently controls the specified possessable.

Returns: true if the possessor's possession list contains the given possessable.

IsPossessing<T> (type check)

Checks whether the possessor currently controls any entity of the given type.

Returns: true if any possession's owner is of type T.

ReleaseAll

Releases all currently possessed entities.

Examples

Player Possessing an NPC

Finding a Specific Possession

Releasing All Before Possessing

See Also

Last updated