Vixen
02b45cc4
csharp
public interface ISceneBehaviorBinder

Attaching, reading and removing one behaviour type without naming it.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ Typed, and closed once at registration, which is the whole reason this interface exists. Add``1 buckets by the static type at the call site — that is what keeps the update loop monomorphic over a contiguous array — so a type-erased attach through Add<Behavior> would put every behaviour in the project into one bucket and undo the arrangement BehaviorStore is built around. Closing the generic here means the editor and the scene loader can work in Type and the store still sees the concrete one.

Fields and properties (2)

  • string Name

    The name a scene carries — the behaviour's [DataContract] alias.

  • Type BehaviorType

    The CLR type.

Methods (7)

  • object Create()

    A fresh instance, unattached.

  • object Copy(object behavior)

    An unattached copy of one, carrying exactly the state a scene would.

  • byte[] Save(object behavior)

    The behaviour's state as bytes, which outlive the type that held it.

  • object Restore(byte[] state)

    An instance carrying state Save wrote.

  • Behavior? Attached(BehaviorStore store, Entity entity)

    The behaviour of this type on an entity, if it has one.

  • void AttachTo(BehaviorStore store, Entity entity, object behavior)

    Attaches one, replacing whatever of this type was there.

  • bool RemoveFrom(BehaviorStore store, Entity entity)

    Takes it off an entity, now.

Used by (8)

  • BehaviorRegistrationTestsVixen.Engine.Tests
  • SceneBehaviorBinderVixen.Engine
  • SceneBehaviorRegistryVixen.Engine
  • BehaviorBridgeVixen.Editor.SceneView
  • EditorApplicationVixen.Editor.App
  • ProjectAssemblyTestsVixen.Editor.App.Tests
  • RegisteredVixen.Editor.App
  • SceneSerializerVixen.Editor.SceneView