C# 클래스 UnityPlatformer.PlatformerCollider2D

Handle collisions with the world
상속: RaycastController
파일 보기 프로젝트 열기: llafuente/unity-platformer 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
enableSlopes bool
maxClimbAngle float
maxDescendAngle float
minTranslation float
onLanding System.Action
onLeaveGround System.Action
onLeftWall System.Action
onRightWall System.Action
onTop System.Action
wallAngle float

공개 메소드들

메소드 설명
ClimbSlope ( Vector3 &velocity ) : void

Modify velocity to smooth climb current slope

ConsolidateCollisions ( ) : void

After all work, notify changes

DescendSlope ( Vector3 &velocity ) : void

Modify velocity to smooth descend current slope

DiagonalCollisions ( Vector3 &velocity ) : void

Unused. This may be redundant still experimental to fix some edge cases...

DisableLeaveGround ( ) : void

same as: 'leavingGround=false' to be used with: UpdateManager.SetTimeout

DisableSlopes ( float resetDelay = 0.5f ) : void

Disable slopes, so no more ClimbSlope/DescendSlope This is important, because while on slope, velocity.y will be modified If you need your velocity to remain, you must disable slopes.\n NOTE use it for jumping over a slope

EnableLeaveGround ( float resetDelay = 0.5f ) : void

leavingGround = true during resetDelay time

EnableSlopes ( ) : void

same as: 'enableSlopes=true' to be used with: UpdateManager.SetTimeout

FallThroughPlatform ( float resetDelay = 0.5f ) : void

fallingThroughPlatform = true during resetDelay time

GetDownSlopeDir ( ) : Vector3

Vector pointing were to descend / slip

HorizontalCollisions ( RaycastHit2D &ray, Vector3 &velocity, int dir, int idx ) : void

Callback for ForeachLeftRay/ForeachRightRay

IsOnGround ( int graceFrames ) : bool

Collider is/was on ground. This is useful to give player some help, no pixel precision jumps :)

Move ( Vector3 velocity, float delta ) : Vector3

Attempt to move the character to current position + velocity. Any colliders in our way will cause velocity to be modified ex: wall -> stop. slope -> modifiy velocity.\n NOTE collisions.velocity has the real velocity applied

OnEnable ( ) : void
ResetFallingThroughPlatform ( ) : void

same as: 'fallingThroughPlatform=false' to be used with: UpdateManager.SetTimeout

Start ( ) : void
UpdateCurrentSlope ( Vector3 velocity ) : void

Launch rays and get the maximum slope found

VerticalCollisions ( RaycastHit2D &ray, Vector3 &velocity, int dir, int idx ) : void

Callback for ForeachHeadRay/ForeachFeetRay

메소드 상세

ClimbSlope() 공개 메소드

Modify velocity to smooth climb current slope
public ClimbSlope ( Vector3 &velocity ) : void
velocity Vector3 Amount to be moved
리턴 void

ConsolidateCollisions() 공개 메소드

After all work, notify changes
public ConsolidateCollisions ( ) : void
리턴 void

DescendSlope() 공개 메소드

Modify velocity to smooth descend current slope
public DescendSlope ( Vector3 &velocity ) : void
velocity Vector3 Amount to be moved
리턴 void

DiagonalCollisions() 공개 메소드

Unused. This may be redundant still experimental to fix some edge cases...
public DiagonalCollisions ( Vector3 &velocity ) : void
velocity Vector3 Amount to be moved
리턴 void

DisableLeaveGround() 공개 메소드

same as: 'leavingGround=false' to be used with: UpdateManager.SetTimeout
public DisableLeaveGround ( ) : void
리턴 void

DisableSlopes() 공개 메소드

Disable slopes, so no more ClimbSlope/DescendSlope This is important, because while on slope, velocity.y will be modified If you need your velocity to remain, you must disable slopes.\n NOTE use it for jumping over a slope
public DisableSlopes ( float resetDelay = 0.5f ) : void
resetDelay float 0 means no reset
리턴 void

EnableLeaveGround() 공개 메소드

leavingGround = true during resetDelay time
public EnableLeaveGround ( float resetDelay = 0.5f ) : void
resetDelay float 0 means no reset
리턴 void

EnableSlopes() 공개 메소드

same as: 'enableSlopes=true' to be used with: UpdateManager.SetTimeout
public EnableSlopes ( ) : void
리턴 void

FallThroughPlatform() 공개 메소드

fallingThroughPlatform = true during resetDelay time
public FallThroughPlatform ( float resetDelay = 0.5f ) : void
resetDelay float 0 means no reset
리턴 void

GetDownSlopeDir() 공개 메소드

Vector pointing were to descend / slip
public GetDownSlopeDir ( ) : Vector3
리턴 Vector3

HorizontalCollisions() 공개 메소드

Callback for ForeachLeftRay/ForeachRightRay
public HorizontalCollisions ( RaycastHit2D &ray, Vector3 &velocity, int dir, int idx ) : void
ray UnityEngine.RaycastHit2D result of Raycast horizontally
velocity Vector3 Amount to be moved
dir int Direction
idx int ray index
리턴 void

IsOnGround() 공개 메소드

Collider is/was on ground. This is useful to give player some help, no pixel precision jumps :)
public IsOnGround ( int graceFrames ) : bool
graceFrames int 0 means current frame
리턴 bool

Move() 공개 메소드

Attempt to move the character to current position + velocity. Any colliders in our way will cause velocity to be modified ex: wall -> stop. slope -> modifiy velocity.\n NOTE collisions.velocity has the real velocity applied
public Move ( Vector3 velocity, float delta ) : Vector3
velocity Vector3 Amount to be moved (velocity * delta)
delta float Time since last update
리턴 Vector3

OnEnable() 공개 메소드

public OnEnable ( ) : void
리턴 void

ResetFallingThroughPlatform() 공개 메소드

same as: 'fallingThroughPlatform=false' to be used with: UpdateManager.SetTimeout
public ResetFallingThroughPlatform ( ) : void
리턴 void

Start() 공개 메소드

public Start ( ) : void
리턴 void

UpdateCurrentSlope() 공개 메소드

Launch rays and get the maximum slope found
public UpdateCurrentSlope ( Vector3 velocity ) : void
velocity Vector3 Amount to be moved
리턴 void

VerticalCollisions() 공개 메소드

Callback for ForeachHeadRay/ForeachFeetRay
public VerticalCollisions ( RaycastHit2D &ray, Vector3 &velocity, int dir, int idx ) : void
ray UnityEngine.RaycastHit2D result of Raycast vertically
velocity Vector3 Amount to be moved
dir int Direction
idx int ray index
리턴 void

프로퍼티 상세

enableSlopes 공개적으로 프로퍼티

Enable slopes Slopes modify Y position of the collider, even when velocity is really X only, to give a smooth movement
public bool enableSlopes
리턴 bool

maxClimbAngle 공개적으로 프로퍼티

Maximum angle the collider can walk-up
public float maxClimbAngle
리턴 float

maxDescendAngle 공개적으로 프로퍼티

Maximum angle the collider can walk-down
public float maxDescendAngle
리턴 float

minTranslation 공개적으로 프로퍼티

Prevent unwanted micro changes in orientation/falling. Makes the Collider more stable to changes.\n This is not a magnitude, handle X/Y separately
public float minTranslation
리턴 float

onLanding 공개적으로 프로퍼티

Collider hit the ground
public Action,System onLanding
리턴 System.Action

onLeaveGround 공개적으로 프로퍼티

Collider leave ground
public Action,System onLeaveGround
리턴 System.Action

onLeftWall 공개적으로 프로퍼티

Collider hit a wall on left side
public Action,System onLeftWall
리턴 System.Action

onRightWall 공개적으로 프로퍼티

Collider hit a wall on right side
public Action,System onRightWall
리턴 System.Action

onTop 공개적으로 프로퍼티

Collider hit something with the 'Head'
public Action,System onTop
리턴 System.Action

wallAngle 공개적으로 프로퍼티

Greater than wallAngle will be considered a Wall, not a slope
public float wallAngle
리턴 float