HasTransformExtensionsΒΆ

class HasTransformExtensions : System.Object

Extension methods which assist developers in writing classes that implement T:Protogame.IHasTransform.

public Protogame.IFinalTransform GetAttachedFinalTransformImplementation(IHasTransform hasTransform, INode node)

Returns a final transform by combining the final transform of the parent in the hierarchy (if the parent node has a transform), and the local transform of this object. You should use this method to implement P:Protogame.IHasTransform.FinalTransform if your object resides in the hierarchy.

Parameters:
  • hasTransform (Protogame.IHasTransform) – The current object.
  • node (Protoinject.INode) – The node in the dependency injection hierarchy that points to this object. This value can be obtained by injecting T:Protoinject.INode into the constructor of your object.
Returns:

A final computed transform.

public Protogame.IFinalTransform GetDetachedFinalTransformImplementation(IHasTransform hasTransform)

Gets a final transform which is just representative of the local transform. This method should be used sparingly, but is intended when either you know the parent of this object will have no transform (i.e. you are implementing an entity which resides directly in the world), or when there’s no way for the caller to know it’s position in the hierarchy.

Parameters:
  • hasTransform (Protogame.IHasTransform) – The current object.
Returns:

A final computed transform.