Vixen
02b45cc4
csharp
public static class Player

Possession: the operations that keep Possessing and PossessedBy consistent with each other.

Read the guide page for this →

Remarks

Two components describe one relationship, and both of them can be written directly. Nothing stops that, and everything that does it will eventually produce a pawn that believes it is possessed by a controller that has forgotten it — the class of bug that shows up as a player whose input goes nowhere after a respawn. This is the only supported way to change who is driving what, and it is what the tests are written against. The same discipline Hierarchy imposes on the transform tree, for the same reason.

[29](../../../docs/plan/29-players-and-possession.md) is the design.

Methods (8)

  • public static Entity Create(World world, byte slot = 0, uint owner = 0)

    Creates a player: a seat with an aim and nothing to drive yet.

  • public static Entity PawnOf(World world, Entity controller)

    What a controller is driving, or Null.

  • public static Entity ControllerOf(World world, Entity pawn)

    What is driving a pawn, or Null.

  • public static bool IsPossessed(World world, Entity pawn)

    Whether anything is driving a pawn.

  • public static void Possess(World world, Entity controller, Entity pawn)

    Puts a controller in charge of a pawn.

  • public static Entity Unpossess(World world, Entity controller)

    Takes a controller off whatever it is driving.

  • public static void BindCamera(World world, Entity controller, Entity shot)

    Says which shot shows this player what they are driving.

  • public static Entity Release(World world, Entity pawn)

    Releases whatever is driving a pawn, leaving that controller driving nothing.

Used by (15)

  • PlayerRigThirdPersonShooter
  • WeaponFireThirdPersonShooter
  • LocalPlayerSystemVixen.Net.Engine
  • LocalPlayerSystemTestsVixen.Net.Engine.Tests
  • PlayerAllocationTestsVixen.Engine.Tests
  • PlayerCameraTestsVixen.Engine.Tests
  • PlayerCamerasVixen.Engine
  • PlayerInputQuantizeSystemTestsVixen.Net.Engine.Tests
  • PlayerInputTestsVixen.Engine.Tests
  • PlayerSpawnerVixen.Net.Engine
  • PlayerSpawnerTestsVixen.Net.Engine.Tests
  • PossessionSystemVixen.Engine
  • PossessionTestsVixen.Engine.Tests
  • PredictedPlayerMovementVixen.Net.Physics
  • PredictedPlayerMovementTestsVixen.Net.Physics.Tests