TopDown Engine
v3.6
|
a controller to move a rigidbody2D and collider2D around in top down view More...
Public Member Functions | |
override void | Impact (Vector3 direction, float force) |
Another way to add a force of the specified force and direction More... | |
override void | AddForce (Vector3 movement) |
Adds a force of the specified vector More... | |
override void | SetMovement (Vector3 movement) |
Sets the current movement More... | |
override void | MovePosition (Vector3 newPosition) |
Tries to move to the specified position More... | |
override void | ResizeColliderHeight (float newHeight, bool translateCenter=false) |
Resizes the collider to the new size set in parameters More... | |
override void | ResetColliderSize () |
Returns the collider to its initial size More... | |
virtual void | SetMovingPlatform (MovingPlatform2D platform) |
Sets a moving platform to this controller More... | |
override void | SetKinematic (bool state) |
Sets this rigidbody as kinematic More... | |
override void | CollisionsOn () |
Enables the collider More... | |
override void | CollisionsOff () |
Disables the collider More... | |
override void | DetectObstacles (float distance, Vector3 offset) |
Performs a cardinal collision check and stores collision objects informations More... | |
override void | Reset () |
On reset, we reset our rb's velocity More... | |
Public Member Functions inherited from MoreMountains.TopDownEngine.TopDownController | |
virtual void | SetGravityActive (bool status) |
Sets gravity active or inactive More... | |
virtual bool | CanGoBackToOriginalSize () |
Returns true if the controller's collider can go back to original size without hitting an obstacle, false otherwise More... | |
Public Attributes | |
bool | OverHole = false |
whether or not the character is above a hole right now More... | |
LayerMask | GroundLayerMask = LayerManager.GroundLayerMask |
the layer mask to consider as ground More... | |
LayerMask | HoleLayerMask = LayerManager.HoleLayerMask |
the layer mask to consider as holes More... | |
LayerMask | ObstaclesLayerMask = LayerManager.ObstaclesLayerMask |
the layer to consider as obstacles (will prevent movement) More... | |
Public Attributes inherited from MoreMountains.TopDownEngine.TopDownController | |
float | Gravity = 40f |
the current gravity to apply to our character (positive goes down, negative goes up, higher value, higher acceleration) More... | |
bool | GravityActive = true |
whether or not the gravity is currently being applied to this character More... | |
float | CrouchedRaycastLengthMultiplier = 1f |
by default, the length of the raycasts used to get back to normal size will be auto generated based on your character's normal/standing height, but here you can specify a different value More... | |
bool | PerformCardinalObstacleRaycastDetection = false |
if this is true, extra raycasts will be cast on all 4 sides to detect obstacles and feed the CollidingWithCardinalObstacle bool, only useful when working with grid movement, or if you need that info for some reason More... | |
Vector3 | Speed |
the current speed of the character More... | |
Vector3 | Velocity |
the current velocity More... | |
Vector3 | VelocityLastFrame |
the velocity of the character last frame More... | |
Vector3 | Acceleration |
the current acceleration More... | |
bool | Grounded |
whether or not the character is grounded More... | |
bool | JustGotGrounded |
whether or not the character got grounded this frame More... | |
Vector3 | CurrentMovement |
the current movement of the character More... | |
Vector3 | CurrentDirection |
the direction the character is going in More... | |
float | Friction |
the current friction More... | |
Vector3 | AddedForce |
the current added force, to be added to the character's movement More... | |
bool | FreeMovement = true |
whether or not the character is in free movement mode or not More... | |
Protected Member Functions | |
override void | Awake () |
On awake we grabd our components More... | |
override void | CheckIfGrounded () |
Determines whether or not this character is grounded More... | |
override void | Update () |
On update we determine our acceleration More... | |
override void | LateUpdate () |
On late update, we apply an impact More... | |
override void | HandleFriction () |
Handles the friction, still a work in progress (todo) More... | |
override void | FixedUpdate () |
On fixed update, we move our rigidbody More... | |
virtual void | ApplyImpact () |
Applies the current impact More... | |
override void | DetermineDirection () |
Determines the controller's current direction More... | |
Protected Member Functions inherited from MoreMountains.TopDownEngine.TopDownController | |
virtual void | ComputeSpeed () |
Computes the speed More... | |
Protected Attributes | |
Rigidbody2D | _rigidBody |
BoxCollider2D | _boxCollider |
bool | _boxColliderNull |
CapsuleCollider2D | _capsuleCollider |
bool | _capsuleColliderNull |
CircleCollider2D | _circleCollider |
bool | _circleColliderNull |
Vector2 | _originalColliderSize |
Vector3 | _originalColliderCenter |
Vector3 | _originalSizeRaycastOrigin |
Vector3 | _orientedMovement |
Collider2D | _groundedTest |
Collider2D | _holeTestMin |
Collider2D | _holeTestMax |
MovingPlatform2D | _movingPlatform |
Vector3 | _movingPlatformPositionLastFrame |
RaycastHit2D | _raycastUp |
RaycastHit2D | _raycastDown |
RaycastHit2D | _raycastLeft |
RaycastHit2D | _raycastRight |
Protected Attributes inherited from MoreMountains.TopDownEngine.TopDownController | |
Vector3 | _positionLastFrame |
Vector3 | _speedComputation |
bool | _groundedLastFrame |
Vector3 | _impact |
Properties | |
override Vector3 | ColliderCenter [get] |
the collider's center position More... | |
override Vector3 | ColliderBottom [get] |
the collider's bottom position More... | |
override Vector3 | ColliderTop [get] |
the collider's top position More... | |
override bool | OnAMovingPlatform [get] |
whether or not the character is on a moving platform More... | |
override Vector3 | MovingPlatformSpeed [get] |
the speed of the moving platform More... | |
Vector2 | ColliderSize [get, set] |
Vector2 | ColliderOffset [get, set] |
Bounds | ColliderBounds [get] |
Properties inherited from MoreMountains.TopDownEngine.TopDownController | |
virtual Vector3 | ColliderCenter [get] |
the collider's center coordinates More... | |
virtual Vector3 | ColliderBottom [get] |
the collider's bottom coordinates More... | |
virtual Vector3 | ColliderTop [get] |
the collider's top coordinates More... | |
virtual GameObject | ObjectBelow [get, set] |
the object (if any) below our character More... | |
virtual SurfaceModifier | SurfaceModifierBelow [get, set] |
the surface modifier object below our character (if any) More... | |
virtual Vector3 | AppliedImpact [get] |
virtual bool | OnAMovingPlatform [get, set] |
whether or not the character is on a moving platform More... | |
virtual Vector3 | MovingPlatformSpeed [get, set] |
the speed of the moving platform More... | |
virtual GameObject | DetectedObstacleLeft [get, set] |
virtual GameObject | DetectedObstacleRight [get, set] |
virtual GameObject | DetectedObstacleUp [get, set] |
virtual GameObject | DetectedObstacleDown [get, set] |
virtual bool | CollidingWithCardinalObstacle [get, set] |
Additional Inherited Members | |
Static Protected Attributes inherited from MoreMountains.TopDownEngine.TopDownController | |
const float | _smallValue =0.0001f |
a controller to move a rigidbody2D and collider2D around in top down view
|
virtual |
Adds a force of the specified vector
movement |
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
protectedvirtual |
Applies the current impact
|
protectedvirtual |
On awake we grabd our components
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
protectedvirtual |
Determines whether or not this character is grounded
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
virtual |
Disables the collider
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
virtual |
Enables the collider
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
virtual |
Performs a cardinal collision check and stores collision objects informations
distance | |
offset |
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
protectedvirtual |
Determines the controller's current direction
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
protectedvirtual |
On fixed update, we move our rigidbody
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
protectedvirtual |
Handles the friction, still a work in progress (todo)
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
virtual |
Another way to add a force of the specified force and direction
direction | |
force |
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
protectedvirtual |
On late update, we apply an impact
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
virtual |
Tries to move to the specified position
newPosition |
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
virtual |
On reset, we reset our rb's velocity
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
virtual |
Returns the collider to its initial size
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
virtual |
Resizes the collider to the new size set in parameters
newSize | New size. |
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
virtual |
Sets this rigidbody as kinematic
state |
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
virtual |
Sets the current movement
movement |
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
virtual |
Sets a moving platform to this controller
platform |
|
protectedvirtual |
On update we determine our acceleration
Reimplemented from MoreMountains.TopDownEngine.TopDownController.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
LayerMask MoreMountains.TopDownEngine.TopDownController2D.GroundLayerMask = LayerManager.GroundLayerMask |
the layer mask to consider as ground
LayerMask MoreMountains.TopDownEngine.TopDownController2D.HoleLayerMask = LayerManager.HoleLayerMask |
the layer mask to consider as holes
LayerMask MoreMountains.TopDownEngine.TopDownController2D.ObstaclesLayerMask = LayerManager.ObstaclesLayerMask |
the layer to consider as obstacles (will prevent movement)
bool MoreMountains.TopDownEngine.TopDownController2D.OverHole = false |
whether or not the character is above a hole right now
|
get |
the collider's bottom position
|
get |
|
get |
the collider's center position
|
getset |
|
getset |
|
get |
the collider's top position
|
get |
the speed of the moving platform
|
get |
whether or not the character is on a moving platform