PossessableExtensions

Static extension methods for IPossessable that delegate possession state queries to the underlying Possessable component.

Definition

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

public static class PossessableExtensions

Remarks

All methods delegate to IPossessable.Possessable, providing a clean API for game code that works with the IPossessable interface rather than the concrete Possessable MonoBehaviour.

Quick Lookup

Goal
How

Check if possessed

possessable.IsPossessed()

Check possessor type

possessable.IsPossessedBy<Player>()

Get current possessor

possessable.GetPossessor()

Safely get typed possessor

possessable.TryGetPossessor<Player>(out var player)

Methods

IsPossessed

Returns true if the possessable is currently possessed by any possessor.

Returns: true if a possessor currently controls this entity.

IsPossessedBy<TPossessor>

Returns true if the possessable is possessed by a possessor whose owner is of type TPossessor.

Returns: true if the current possessor's owner implements TPossessor.

GetPossessor

Returns the Possessor component currently controlling this possessable.

Returns: The Possessor instance, or null if not possessed.

TryGetPossessor<TPossessor>

Attempts to get the possessor's owner cast to a specific type.

Parameter
Type
Description

possessor

out TPossessor

The typed possessor owner, or null

Returns: true if the possessor's owner is of type TPossessor.

Common Pitfalls

circle-exclamation
circle-exclamation

Examples

Checking Possession State

See Also

Last updated