C# Class Nez.Collider

Afficher le fichier Open project: prime31/Nez Class Usage Examples

Méthodes publiques

Свойство Type Description
collidesWithLayers int
isTrigger bool
physicsLayer int
shape Nez.PhysicsShapes.Shape
shouldColliderScaleAndRotateWithTransform bool

Protected Properties

Свойство Type Description
_colliderRequiresAutoSizing bool
_isColliderRegistered bool
_isParentEntityAddedToScene bool
_localOffset Vector2

Méthodes publiques

Méthode Description
clone ( ) : Component
collidesWith ( Collider collider, CollisionResult &result ) : bool

checks to see if this Collider collides with collider. If it does, true will be returned and result will be populated with collision data

collidesWith ( Collider collider, Vector2 motion, CollisionResult &result ) : bool

checks to see if this Collider with motion applied (delta movement vector) collides with collider. If it does, true will be returned and result will be populated with collision data.

collidesWithAny ( CollisionResult &result ) : bool

checks to see if this Collider collides with any other Colliders in the Scene. The first Collider it intersects will have its collision data returned in the CollisionResult.

collidesWithAny ( Vector2 &motion, CollisionResult &result ) : bool

checks to see if this Collider with motion applied (delta movement vector) collides with any collider. If it does, true will be returned and result will be populated with collision data. Motion will be set to the maximum distance the Collider can travel before colliding.

onAddedToEntity ( ) : void
onDisabled ( ) : void
onEnabled ( ) : void
onEntityTransformChanged ( Transform comp ) : void
onRemovedFromEntity ( ) : void
overlaps ( Collider other ) : bool

checks to see if this shape overlaps any other Colliders in the Physics system

registerColliderWithPhysicsSystem ( ) : void

the parent Entity will call this at various times (when added to a scene, enabled, etc)

setLocalOffset ( Vector2 offset ) : Collider

localOffset is added to entity.position to get the final position for the collider. This allows you to add multiple Colliders to an Entity and position them separately.

setShouldColliderScaleAndRotateWithTransform ( bool shouldColliderScaleAndRotateWithTransform ) : Collider

if set to true, the Collider will scale and rotate following the Transform it is attached to

unregisterColliderWithPhysicsSystem ( ) : void

the parent Entity will call this at various times (when removed from a scene, disabled, etc)

Method Details

clone() public méthode

public clone ( ) : Component
Résultat Component

collidesWith() public méthode

checks to see if this Collider collides with collider. If it does, true will be returned and result will be populated with collision data
public collidesWith ( Collider collider, CollisionResult &result ) : bool
collider Collider Collider.
result CollisionResult Result.
Résultat bool

collidesWith() public méthode

checks to see if this Collider with motion applied (delta movement vector) collides with collider. If it does, true will be returned and result will be populated with collision data.
public collidesWith ( Collider collider, Vector2 motion, CollisionResult &result ) : bool
collider Collider Collider.
motion Vector2 Motion.
result CollisionResult Result.
Résultat bool

collidesWithAny() public méthode

checks to see if this Collider collides with any other Colliders in the Scene. The first Collider it intersects will have its collision data returned in the CollisionResult.
public collidesWithAny ( CollisionResult &result ) : bool
result CollisionResult Result.
Résultat bool

collidesWithAny() public méthode

checks to see if this Collider with motion applied (delta movement vector) collides with any collider. If it does, true will be returned and result will be populated with collision data. Motion will be set to the maximum distance the Collider can travel before colliding.
public collidesWithAny ( Vector2 &motion, CollisionResult &result ) : bool
motion Vector2 Motion.
result CollisionResult Result.
Résultat bool

onAddedToEntity() public méthode

public onAddedToEntity ( ) : void
Résultat void

onDisabled() public méthode

public onDisabled ( ) : void
Résultat void

onEnabled() public méthode

public onEnabled ( ) : void
Résultat void

onEntityTransformChanged() public méthode

public onEntityTransformChanged ( Transform comp ) : void
comp Transform
Résultat void

onRemovedFromEntity() public méthode

public onRemovedFromEntity ( ) : void
Résultat void

overlaps() public méthode

checks to see if this shape overlaps any other Colliders in the Physics system
public overlaps ( Collider other ) : bool
other Collider
Résultat bool

registerColliderWithPhysicsSystem() public méthode

the parent Entity will call this at various times (when added to a scene, enabled, etc)
public registerColliderWithPhysicsSystem ( ) : void
Résultat void

setLocalOffset() public méthode

localOffset is added to entity.position to get the final position for the collider. This allows you to add multiple Colliders to an Entity and position them separately.
public setLocalOffset ( Vector2 offset ) : Collider
offset Vector2 Offset.
Résultat Collider

setShouldColliderScaleAndRotateWithTransform() public méthode

if set to true, the Collider will scale and rotate following the Transform it is attached to
public setShouldColliderScaleAndRotateWithTransform ( bool shouldColliderScaleAndRotateWithTransform ) : Collider
shouldColliderScaleAndRotateWithTransform bool If set to true should collider scale and rotate with transform.
Résultat Collider

unregisterColliderWithPhysicsSystem() public méthode

the parent Entity will call this at various times (when removed from a scene, disabled, etc)
public unregisterColliderWithPhysicsSystem ( ) : void
Résultat void

Property Details

_colliderRequiresAutoSizing protected_oe property

protected bool _colliderRequiresAutoSizing
Résultat bool

_isColliderRegistered protected_oe property

flag to keep track of if we registered ourself with the Physics system
protected bool _isColliderRegistered
Résultat bool

_isParentEntityAddedToScene protected_oe property

flag to keep track of if our Entity was added to a Scene
protected bool _isParentEntityAddedToScene
Résultat bool

_localOffset protected_oe property

protected Vector2 _localOffset
Résultat Vector2

collidesWithLayers public_oe property

layer mask of all the layers this Collider should collide with when Entity.move methods are used. defaults to all layers.
public int collidesWithLayers
Résultat int

isTrigger public_oe property

if this collider is a trigger it will not cause collisions but it will still trigger events
public bool isTrigger
Résultat bool

physicsLayer public_oe property

physicsLayer can be used as a filter when dealing with collisions. The Flags class has methods to assist with bitmasks.
public int physicsLayer
Résultat int

shape public_oe property

the underlying Shape of the Collider
public Shape,Nez.PhysicsShapes shape
Résultat Nez.PhysicsShapes.Shape

shouldColliderScaleAndRotateWithTransform public_oe property

if true, the Collider will scale and rotate following the Transform it is attached to
public bool shouldColliderScaleAndRotateWithTransform
Résultat bool