PossessAction

Abstract Action subclass providing possess/release context. Executed during possession transitions by Possessor and Possessable to run custom logic (e.g., camera transitions, animation triggers, UI changes).

Definition

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

[Serializable]
public abstract class PossessAction : Action

Inheritance: Action → PossessAction

Remarks

PossessAction is a thin wrapper around Action that adds a context-aware Execute(Possessor, Possessable) overload. This sets the possessor and possessable protected fields before delegating to the standard Action.Execute() pipeline.

Both Possessor and Possessable have serialized PossessAction fields:

  • Possessor has possessAction (runs on possess) and releaseAction (runs on release)

  • Possessable has possessedAction (runs when possessed) and releasedAction (runs when released)

This means up to four PossessAction instances can fire during a single possess transition.

Quick Lookup

Goal
How

Create a custom action

Subclass PossessAction, override OnExecute()

Access the possessor

this.possessor (protected field)

Access the possessable

this.possessable (protected field)

Assign in Inspector

Serialize on Possessor or Possessable components

Methods

Execute (context overload)

Sets the possess/release context and starts execution.

Parameter
Type
Description

possessor

Possessor

The possessor involved in the transition

possessable

Possessable

The possessable involved in the transition

circle-info

This calls the inherited Action.Execute() (fire-and-forget) after setting context fields. The action runs asynchronously via the CancellableTask pipeline.

Extension Points

Required Overrides

Method
Return Type
Purpose

OnExecute()

Task

Core logic of the possess/release action (inherited from Action)

Optional Overrides

Method
Return Type
Purpose

OnBegin()

void

Setup before execution

OnComplete()

void

Cleanup on success

OnCancel()

void

Cleanup on cancellation

OnEnd()

void

Final cleanup regardless of outcome

Implementation Requirements

When subclassing PossessAction, you MUST:

  1. Override OnExecute() and return a Task

  2. Mark the class with [Serializable]

You SHOULD:

  • Use Yield methods for frame-based waiting (integrates with cancellation)

  • Access possessor and possessable only within OnExecute() or later lifecycle hooks

  • Use [Variable] for configurable parameters

Fields (protected)

possessor

The entity taking or releasing control.

possessable

The entity being possessed or released.

Common Pitfalls

circle-exclamation
circle-exclamation

Examples

Camera Transition on Possess

Instant Action (synchronous)

See Also

  • Action — base class providing async execution

  • Possessor — component that triggers possess actions

  • Possessable — component that triggers possessed actions

  • PossessInteraction — interaction-system bridge for possession

Last updated