C# 클래스 Nez.Spatial.SpatialHash

파일 보기 프로젝트 열기: prime31/Nez 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
gridBounds Microsoft.Xna.Framework.Rectangle

공개 메소드들

메소드 설명
SpatialHash ( int cellSize = 100 ) : System
aabbBroadphase ( RectangleF &bounds, Collider excludeCollider, int layerMask ) : HashSet

returns all objects in cells that the bounding box intersects

clear ( ) : void
debugDraw ( float secondsToDisplay, float textScale = 1f ) : void

debug draws the contents of the spatial hash. Note that Core.debugRenderEnabled must be true or nothing will be displayed.

debugDrawCellDetails ( int x, int y, int cellCount, float secondsToDisplay = 0.5f, float textScale = 1f ) : void
getAllObjects ( ) : HashSet

returns all the Colliders in the SpatialHash

linecast ( Vector2 start, Vector2 end, RaycastHit hits, int layerMask ) : int

casts a line through the spatial hash and fills the hits array up with any colliders that the line hits

overlapCircle ( Vector2 circleCenter, float radius, Collider results, int layerMask ) : int

gets all the colliders that fall within the specified circle

overlapRectangle ( RectangleF &rect, Collider results, int layerMask ) : int

gets all the colliders that fall within the specified rect

register ( Collider collider ) : void

adds the object to the SpatialHash

remove ( Collider collider ) : void

removes the object from the SpatialHash

removeWithBruteForce ( Collider obj ) : void

removes the object from the SpatialHash using a brute force approach

비공개 메소드들

메소드 설명
cellAtPosition ( int x, int y, bool createCellIfEmpty = false ) : List
cellCoords ( float x, float y ) : Point
cellCoords ( int x, int y ) : Point

메소드 상세

SpatialHash() 공개 메소드

public SpatialHash ( int cellSize = 100 ) : System
cellSize int
리턴 System

aabbBroadphase() 공개 메소드

returns all objects in cells that the bounding box intersects
public aabbBroadphase ( RectangleF &bounds, Collider excludeCollider, int layerMask ) : HashSet
bounds RectangleF Bounds.
excludeCollider Collider
layerMask int Layer mask.
리턴 HashSet

clear() 공개 메소드

public clear ( ) : void
리턴 void

debugDraw() 공개 메소드

debug draws the contents of the spatial hash. Note that Core.debugRenderEnabled must be true or nothing will be displayed.
public debugDraw ( float secondsToDisplay, float textScale = 1f ) : void
secondsToDisplay float Seconds to display.
textScale float Text scale.
리턴 void

debugDrawCellDetails() 공개 메소드

public debugDrawCellDetails ( int x, int y, int cellCount, float secondsToDisplay = 0.5f, float textScale = 1f ) : void
x int
y int
cellCount int
secondsToDisplay float
textScale float
리턴 void

getAllObjects() 공개 메소드

returns all the Colliders in the SpatialHash
public getAllObjects ( ) : HashSet
리턴 HashSet

linecast() 공개 메소드

casts a line through the spatial hash and fills the hits array up with any colliders that the line hits
public linecast ( Vector2 start, Vector2 end, RaycastHit hits, int layerMask ) : int
start Vector2 Start.
end Vector2 End.
hits RaycastHit Hits.
layerMask int Layer mask.
리턴 int

overlapCircle() 공개 메소드

gets all the colliders that fall within the specified circle
public overlapCircle ( Vector2 circleCenter, float radius, Collider results, int layerMask ) : int
circleCenter Vector2 Circle center.
radius float Radius.
results Collider Results.
layerMask int Layer mask.
리턴 int

overlapRectangle() 공개 메소드

gets all the colliders that fall within the specified rect
public overlapRectangle ( RectangleF &rect, Collider results, int layerMask ) : int
rect RectangleF Rect.
results Collider Results.
layerMask int Layer mask.
리턴 int

register() 공개 메소드

adds the object to the SpatialHash
public register ( Collider collider ) : void
collider Collider Object.
리턴 void

remove() 공개 메소드

removes the object from the SpatialHash
public remove ( Collider collider ) : void
collider Collider Collider.
리턴 void

removeWithBruteForce() 공개 메소드

removes the object from the SpatialHash using a brute force approach
public removeWithBruteForce ( Collider obj ) : void
obj Collider Object.
리턴 void

프로퍼티 상세

gridBounds 공개적으로 프로퍼티

public Rectangle,Microsoft.Xna.Framework gridBounds
리턴 Microsoft.Xna.Framework.Rectangle