Class SFShapeComponent
Base class for the component based
classes used in the SF Metroidvania package.
Inheritance
System.Object
SFShapeComponent
Assembly: cs.temp.dll.dll
Syntax
public abstract class SFShapeComponent : MonoBehaviour, ITriggerShapeCallback, IContactShapeCallback, IPreSolveShapeCallback
Fields
_lastPhysicsPosition
Declaration
protected Vector2 _lastPhysicsPosition
Field Value
_shape
Declaration
protected PhysicsShape _shape
Field Value
| Type |
Description |
| PhysicsShape |
|
_useDelaunay
Should the Delaunay algorithm be used for creating meshes using .
Declaration
protected bool _useDelaunay
Field Value
| Type |
Description |
| System.Boolean |
|
Body
Declaration
Field Value
| Type |
Description |
| PhysicsBody |
|
BodyDefinition
Declaration
public PhysicsBodyDefinition BodyDefinition
Field Value
| Type |
Description |
| PhysicsBodyDefinition |
|
ContainedPhysicsShapes
A list of objects that are currently contained inside of Shape
Declaration
public List<IPhysicsShapeContained> ContainedPhysicsShapes
Field Value
IsCompositeShape
Is the Shape created by multiple separate ?
Declaration
public bool IsCompositeShape
Field Value
| Type |
Description |
| System.Boolean |
|
Offset
Declaration
Field Value
PhysicsWorld
Declaration
public PhysicsWorld PhysicsWorld
Field Value
| Type |
Description |
| PhysicsWorld |
|
ScaleSize
Should the Shape size be scaled with the game objects transform.
Declaration
Field Value
| Type |
Description |
| System.Boolean |
|
ShapeCreatedHandler
Declaration
public Action ShapeCreatedHandler
Field Value
ShapeDefinition
Declaration
public PhysicsShapeDefinition ShapeDefinition
Field Value
| Type |
Description |
| PhysicsShapeDefinition |
|
ShapeDestroyedHandler
Declaration
public Action ShapeDestroyedHandler
Field Value
ShapesInComposite
Declaration
public NativeList<PhysicsShape> ShapesInComposite
Field Value
| Type |
Description |
| NativeList<PhysicsShape> |
|
Declaration
public bool UpdateTransform
Field Value
| Type |
Description |
| System.Boolean |
|
Properties
IsPositionChanged
Declaration
protected bool IsPositionChanged { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
Shape
Declaration
public ref PhysicsShape Shape { get; }
Property Value
| Type |
Description |
| PhysicsShape |
|
ShapeProxy
The generic proxy data container for the Shape
Used to allow support for all types of shapes and geometry when
doing queries and casting.
for an example of use cases.
Declaration
public PhysicsShape.ShapeProxy ShapeProxy { get; }
Property Value
| Type |
Description |
| PhysicsShape.ShapeProxy |
|
World
Declaration
public PhysicsWorld World { get; }
Property Value
| Type |
Description |
| PhysicsWorld |
|
Methods
Declaration
public void AddContactCallbackTarget(IContactShapeCallback target)
Parameters
AddPreSolveCallbackTarget(IPreSolveShapeCallback)
Declaration
public void AddPreSolveCallbackTarget(IPreSolveShapeCallback target)
Parameters
AddTriggerCallbackTarget(ITriggerShapeCallback)
Declaration
public void AddTriggerCallbackTarget(ITriggerShapeCallback target)
Parameters
Declaration
public void ApplyTransform()
Declaration
public void CacheTransform()
CalculateAABB()
Declaration
public PhysicsAABB CalculateAABB()
Returns
| Type |
Description |
| PhysicsAABB |
|
CreateBody()
Declaration
protected virtual void CreateBody()
CreateBodyShapeGeometry()
Creates the Shape geometry to use when calling the method or other CreateShape method.
Declaration
protected virtual void CreateBodyShapeGeometry()
CreateShape()
Declaration
protected virtual void CreateShape()
DebugPhysics()
If debugging is enabled in editor, a set of logs will be sent to console just in case something was not set right.
Declaration
[Conditional("UNITY_EDITOR")]
public virtual void DebugPhysics()
Override this to add custom debug log checking on top of the normal checks in DebugPhysics.
This runs even when UsingDebugMode is set to false
and is only ran inside of the editor at the current moment. Runtime support coming soon.
Declaration
[Conditional("UNITY_EDITOR")]
protected virtual void DebugPhysicsExtra()
DestroyBody()
Declaration
protected virtual void DestroyBody()
DestroyShape()
Declaration
protected virtual void DestroyShape()
FixedUpdate()
Declaration
protected void FixedUpdate()
GetAABB(in PhysicsShape)
Declaration
public static PhysicsAABB GetAABB(in PhysicsShape physicsShape)
Parameters
| Type |
Name |
Description |
| PhysicsShape |
physicsShape |
|
Returns
| Type |
Description |
| PhysicsAABB |
|
Declaration
public void OnContactBegin2D(PhysicsEvents.ContactBeginEvent beginEvent)
Parameters
| Type |
Name |
Description |
| PhysicsEvents.ContactBeginEvent |
beginEvent |
|
Declaration
public void OnContactBegin2D(PhysicsEvents.ContactBeginEvent beginEvent, SFShapeComponent callingShapeComponent)
Parameters
| Type |
Name |
Description |
| PhysicsEvents.ContactBeginEvent |
beginEvent |
|
| SFShapeComponent |
callingShapeComponent |
|
Declaration
public void OnContactEnd2D(PhysicsEvents.ContactEndEvent endEvent)
Parameters
| Type |
Name |
Description |
| PhysicsEvents.ContactEndEvent |
endEvent |
|
Declaration
public void OnContactEnd2D(PhysicsEvents.ContactEndEvent endEvent, SFShapeComponent callingShapeComponent)
Parameters
| Type |
Name |
Description |
| PhysicsEvents.ContactEndEvent |
endEvent |
|
| SFShapeComponent |
callingShapeComponent |
|
OnDisable()
Declaration
protected void OnDisable()
OnEnable()
Declaration
protected void OnEnable()
OnPreSolve2D(PhysicsEvents.PreSolveEvent)
Declaration
public bool OnPreSolve2D(PhysicsEvents.PreSolveEvent preSolveEvent)
Parameters
| Type |
Name |
Description |
| PhysicsEvents.PreSolveEvent |
preSolveEvent |
|
Returns
| Type |
Description |
| System.Boolean |
|
OnPreSolve2D(PhysicsEvents.PreSolveEvent, SFShapeComponent)
Declaration
public bool OnPreSolve2D(PhysicsEvents.PreSolveEvent preSolveEvent, SFShapeComponent callingShapeComponent)
Parameters
| Type |
Name |
Description |
| PhysicsEvents.PreSolveEvent |
preSolveEvent |
|
| SFShapeComponent |
callingShapeComponent |
|
Returns
| Type |
Description |
| System.Boolean |
|
OnTriggerBegin2D(PhysicsEvents.TriggerBeginEvent)
Declaration
public void OnTriggerBegin2D(PhysicsEvents.TriggerBeginEvent beginEvent)
Parameters
| Type |
Name |
Description |
| PhysicsEvents.TriggerBeginEvent |
beginEvent |
|
OnTriggerBegin2D(PhysicsEvents.TriggerBeginEvent, SFShapeComponent)
Declaration
public void OnTriggerBegin2D(PhysicsEvents.TriggerBeginEvent beginEvent, SFShapeComponent callingShapeComponent)
Parameters
| Type |
Name |
Description |
| PhysicsEvents.TriggerBeginEvent |
beginEvent |
|
| SFShapeComponent |
callingShapeComponent |
|
OnTriggerEnd2D(PhysicsEvents.TriggerEndEvent)
Declaration
public void OnTriggerEnd2D(PhysicsEvents.TriggerEndEvent endEvent)
Parameters
| Type |
Name |
Description |
| PhysicsEvents.TriggerEndEvent |
endEvent |
|
OnTriggerEnd2D(PhysicsEvents.TriggerEndEvent, SFShapeComponent)
Declaration
public void OnTriggerEnd2D(PhysicsEvents.TriggerEndEvent endEvent, SFShapeComponent callingShapeComponent)
Parameters
| Type |
Name |
Description |
| PhysicsEvents.TriggerEndEvent |
endEvent |
|
| SFShapeComponent |
callingShapeComponent |
|
OnValidate()
Declaration
protected virtual void OnValidate()
PreDisable()
Used to clean up any resources before changing cleaning up the Shape and Body.
Declaration
protected virtual void PreDisable()
PreEnabled()
Override to set up required components when first adding a SFShapeComponent class to a gameobject.
Example SFTileMapShape requires a TileMap component to be set before generating the Shape.
Declaration
protected virtual void PreEnabled()
Declaration
public void RemoveContactCallbackTarget(IContactShapeCallback target)
Parameters
RemoveTriggerCallbackTarget(ITriggerShapeCallback)
Declaration
public void RemoveTriggerCallbackTarget(ITriggerShapeCallback target)
Parameters
SetShape<TGeometryType>(TGeometryType)
Declaration
public virtual void SetShape<TGeometryType>(TGeometryType geometryType)
where TGeometryType : struct
Parameters
| Type |
Name |
Description |
| TGeometryType |
geometryType |
|
Type Parameters
| Name |
Description |
| TGeometryType |
|
UpdateShape()
Called from editor tools to update the Shape after making changes using editor tools.
Also can be used to force a shape update.
Declaration
public void UpdateShape()
Implements