|
TopDown Engine v4.5
|
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. | |
| override void | AddForce (Vector3 movement) |
| Adds a force of the specified vector. | |
| override void | SetMovement (Vector3 movement) |
| Sets the current movement. | |
| override void | MovePosition (Vector3 newPosition, bool targetTransform=false) |
| Tries to move to the specified position. | |
| override void | ResizeColliderHeight (float newHeight, bool translateCenter=false) |
| Resizes the collider to the new size set in parameters. | |
| override void | ResetColliderSize () |
| Returns the collider to its initial size. | |
| virtual void | SetMovingPlatform (MovingPlatform2D platform) |
| Sets a moving platform to this controller. | |
| override void | SetKinematic (bool state) |
| Sets this rigidbody as kinematic. | |
| override void | CollisionsOn () |
| Enables the collider. | |
| override void | CollisionsOff () |
| Disables the collider. | |
| override void | DetectObstacles (float distance, Vector3 offset) |
| Performs a cardinal collision check and stores collision objects informations. | |
| override void | Reset () |
| On reset, we reset our rb's velocity. | |
| Public Member Functions inherited from MoreMountains.TopDownEngine.TopDownController | |
| virtual void | SetGravityActive (bool status) |
| Sets gravity active or inactive. | |
| virtual bool | CanGoBackToOriginalSize () |
| Returns true if the controller's collider can go back to original size without hitting an obstacle, false otherwise. | |
Public Attributes | |
| bool | OverHole = false |
| whether or not the character is above a hole right now | |
| LayerMask | GroundLayerMask = LayerManager.GroundLayerMask |
| the layer mask to consider as ground | |
| LayerMask | HoleLayerMask = LayerManager.HoleLayerMask |
| the layer mask to consider as holes | |
| LayerMask | ObstaclesLayerMask = LayerManager.ObstaclesLayerMask |
| the layer to consider as obstacles (will prevent movement) | |
| 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) | |
| bool | GravityActive = true |
| whether or not the gravity is currently being applied to this character | |
| 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 | |
| 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 | |
| Vector3 | Speed |
| the current speed of the character | |
| Vector3 | Velocity |
| the current velocity | |
| Vector3 | VelocityLastFrame |
| the velocity of the character last frame | |
| Vector3 | Acceleration |
| the current acceleration | |
| bool | Grounded |
| whether or not the character is grounded | |
| bool | JustGotGrounded |
| whether or not the character got grounded this frame | |
| Vector3 | CurrentMovement |
| the current movement of the character | |
| Vector3 | CurrentDirection |
| the direction the character is going in | |
| float | Friction |
| the current friction | |
| Vector3 | AddedForce |
| the current added force, to be added to the character's movement | |
| bool | FreeMovement = true |
| whether or not the character is in free movement mode or not | |
Protected Member Functions | |
| override void | Awake () |
| On awake we grabd our components. | |
| override void | CheckIfGrounded () |
| Determines whether or not this character is grounded. | |
| override void | FixedUpdate () |
| On fixed update, we move our rigidbody. | |
| virtual void | ComputeNewVelocity () |
| Determines the new Velocity value based on our position and our position last frame. | |
| override void | Update () |
| On update we determine our acceleration. | |
| override void | LateUpdate () |
| On late update, we apply an impact. | |
| override void | HandleFriction () |
| Handles the friction, still a work in progress (todo) | |
| virtual void | ApplyImpact () |
| Applies the current impact. | |
| override void | DetermineDirection () |
| Determines the controller's current direction. | |
| Protected Member Functions inherited from MoreMountains.TopDownEngine.TopDownController | |
| virtual void | ComputeSpeed () |
| Computes the speed. | |
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 | |
| override Vector3 | ColliderBottom [get] |
| the collider's bottom position | |
| override Vector3 | ColliderTop [get] |
| the collider's top position | |
| override bool | OnAMovingPlatform [get] |
| whether or not the character is on a moving platform | |
| override Vector3 | MovingPlatformSpeed [get] |
| the speed of the moving platform | |
| 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 | |
| virtual Vector3 | ColliderBottom [get] |
| the collider's bottom coordinates | |
| virtual Vector3 | ColliderTop [get] |
| the collider's top coordinates | |
| virtual GameObject | ObjectBelow [get, set] |
| the object (if any) below our character | |
| virtual SurfaceModifier | SurfaceModifierBelow [get, set] |
| the surface modifier object below our character (if any) | |
| virtual Vector3 | AppliedImpact [get] |
| virtual bool | OnAMovingPlatform [get, set] |
| whether or not the character is on a moving platform | |
| virtual Vector3 | MovingPlatformSpeed [get, set] |
| the speed of the moving platform | |
| 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.
|
protectedvirtual |
Determines the new Velocity value based on our position and our position last frame.
|
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