Infinite Runner Engine v2.2
Loading...
Searching...
No Matches
MoreMountains.InfiniteRunnerEngine.LaneRunner Class Reference

This is an example of how you can extend playable character, in this case to have a character that can switch lanes by moving left or right. More...

Inheritance diagram for MoreMountains.InfiniteRunnerEngine.LaneRunner:
MoreMountains.InfiniteRunnerEngine.PlayableCharacter

Public Member Functions

override void LeftStart ()
 Triggered when the player presses left.
override void RightStart ()
 Triggered when the player presses right.
override void Die ()
 When the runner dies we instantiate an explosion at the point of impact.
Public Member Functions inherited from MoreMountains.InfiniteRunnerEngine.PlayableCharacter
virtual void SetInitialPosition (Vector3 initialPosition)
 Use this to define the initial position of the agent. Used mainly for reset position purposes.
virtual void Disable ()
 Disables the playable character.
virtual void DisableCollisions ()
 Disables the collisions.
virtual void EnableCollisions ()
 Enables the collisions.
virtual void MainActionStart ()
 What happens when the main action button button is pressed.
virtual void MainActionEnd ()
 What happens when the main action button button is released.
virtual void MainActionOngoing ()
 What happens when the main action button button is being pressed.
virtual void DownStart ()
 What happens when the down button is pressed.
virtual void DownEnd ()
 What happens when the down button is released.
virtual void DownOngoing ()
 What happens when the down button is being pressed.
virtual void UpStart ()
 What happens when the up button is pressed.
virtual void UpEnd ()
 What happens when the up button is released.
virtual void UpOngoing ()
 What happens when the up button is being pressed.
virtual void LeftEnd ()
 What happens when the left button is released.
virtual void LeftOngoing ()
 What happens when the left button is being pressed.
virtual void RightEnd ()
 What happens when the right button is released.
virtual void RightOngoing ()
 What happens when the right button is being pressed.

Public Attributes

float LaneWidth =3f
 the width of each lane
int NumberOfLanes = 3
 the number of lanes the runner can run in
float ChangingLaneSpeed = 1f
 the speed (in seconds) at which the runner changes lane
GameObject Explosion
 the gameobject instantiated when the runner dies
Public Attributes inherited from MoreMountains.InfiniteRunnerEngine.PlayableCharacter
bool UseDefaultMecanim = true
 should we use the default mecanim ?
bool ShouldResetPosition = true
 returns true if the character is currently grounded
float ResetPositionSpeed = 0.5f
float GroundDistanceTolerance = 0.05f
 the distance tolerance at which a character is considered grounded
float InitialInvincibilityDuration = 3f
 the duration (in seconds) of invincibility on spawn

Protected Member Functions

override void Awake ()
 On awake, we handle initialization.
override void Update ()
 On update we handle the animator's update.
IEnumerator MoveTo (Vector3 destination, float movementDuration)
 Moves an object to a destination position in a determined time.
Protected Member Functions inherited from MoreMountains.InfiniteRunnerEngine.PlayableCharacter
virtual void Start ()
 On start - Override this if needed.
virtual void Initialize ()
 This method initializes all essential elements.
virtual void ComputeDistanceToTheGround ()
 Determines the distance between the Jumper and the ground.
virtual bool DetermineIfGroudedConditionsAreMet ()
 Determines if grouded conditions are met.
virtual void CheckDeathConditions ()
 Checks the death conditions.
virtual Bounds GetPlayableCharacterBounds ()
 Gets the playable character bounds.
virtual void UpdateAnimator ()
 This is called at Update() and sets each of the animators parameters to their corresponding State values.
virtual void UpdateAllMecanimAnimators ()
 Updates all mecanim animators.
virtual void ResetPosition ()
 Called on update, tries to return the object to its initial position.
virtual void OnCollisionEnter2D (Collision2D collidingObject)
 Handles enter collision with 2D colliders.
virtual void OnCollisionExit2D (Collision2D collidingObject)
 Handles exit collision with 2D colliders.
virtual void OnCollisionEnter (Collision collidingObject)
 Handles enter collision with 3D colliders.
virtual void OnCollisionExit (Collision collidingObject)
 Handles exit collision with 3D colliders.
virtual void OnTriggerEnter2D (Collider2D collidingObject)
 Handles enter collision with 2D triggers.
virtual void OnTriggerExit2D (Collider2D collidingObject)
 Handles enter collision with 2D triggers.
virtual void OnTriggerEnter (Collider collidingObject)
 Handles enter collision with 2D triggers.
virtual void OnTriggerExit (Collider collidingObject)
 Handles enter collision with 2D triggers.
virtual void CollisionEnter (GameObject collidingObject)
 Override this to define what happens when your playable character enters something.
virtual void CollisionExit (GameObject collidingObject)
 Override this to define what happens when your playable character exits something.
virtual void TriggerEnter (GameObject collidingObject)
 Override this to define what happens when your playable character enters a trigger.
virtual void TriggerExit (GameObject collidingObject)
 Override this to define what happens when your playable character exits a trigger.

Protected Attributes

int _currentLane
bool _isMoving = false
Protected Attributes inherited from MoreMountains.InfiniteRunnerEngine.PlayableCharacter
Vector3 _initialPosition
bool _grounded
MMRigidbodyInterface _rigidbodyInterface
Animator _animator
float _distanceToTheGroundRaycastLength = 50f
GameObject _ground
LayerMask _collisionMaskSave
float _awakeAt
Vector3 _raycastLeftOrigin
Vector3 _raycastRightOrigin

Additional Inherited Members

Properties inherited from MoreMountains.InfiniteRunnerEngine.PlayableCharacter
float DistanceToTheGround [get, protected set]
 the distance between the character and the ground
bool Invincible [get]

Detailed Description

This is an example of how you can extend playable character, in this case to have a character that can switch lanes by moving left or right.

Member Function Documentation

◆ Awake()

override void MoreMountains.InfiniteRunnerEngine.LaneRunner.Awake ( )
protectedvirtual

On awake, we handle initialization.

Reimplemented from MoreMountains.InfiniteRunnerEngine.PlayableCharacter.

◆ Die()

override void MoreMountains.InfiniteRunnerEngine.LaneRunner.Die ( )
virtual

When the runner dies we instantiate an explosion at the point of impact.

Reimplemented from MoreMountains.InfiniteRunnerEngine.PlayableCharacter.

◆ LeftStart()

override void MoreMountains.InfiniteRunnerEngine.LaneRunner.LeftStart ( )
virtual

Triggered when the player presses left.

Reimplemented from MoreMountains.InfiniteRunnerEngine.PlayableCharacter.

◆ MoveTo()

IEnumerator MoreMountains.InfiniteRunnerEngine.LaneRunner.MoveTo ( Vector3 destination,
float movementDuration )
protected

Moves an object to a destination position in a determined time.

Returns
The to.
Parameters
destinationDestination.
movementDurationMovement duration.

◆ RightStart()

override void MoreMountains.InfiniteRunnerEngine.LaneRunner.RightStart ( )
virtual

Triggered when the player presses right.

Reimplemented from MoreMountains.InfiniteRunnerEngine.PlayableCharacter.

◆ Update()

override void MoreMountains.InfiniteRunnerEngine.LaneRunner.Update ( )
protectedvirtual

On update we handle the animator's update.

Reimplemented from MoreMountains.InfiniteRunnerEngine.PlayableCharacter.

Member Data Documentation

◆ _currentLane

int MoreMountains.InfiniteRunnerEngine.LaneRunner._currentLane
protected

◆ _isMoving

bool MoreMountains.InfiniteRunnerEngine.LaneRunner._isMoving = false
protected

◆ ChangingLaneSpeed

float MoreMountains.InfiniteRunnerEngine.LaneRunner.ChangingLaneSpeed = 1f

the speed (in seconds) at which the runner changes lane

◆ Explosion

GameObject MoreMountains.InfiniteRunnerEngine.LaneRunner.Explosion

the gameobject instantiated when the runner dies

◆ LaneWidth

float MoreMountains.InfiniteRunnerEngine.LaneRunner.LaneWidth =3f

the width of each lane

◆ NumberOfLanes

int MoreMountains.InfiniteRunnerEngine.LaneRunner.NumberOfLanes = 3

the number of lanes the runner can run in


The documentation for this class was generated from the following file:
  • Assets/InfiniteRunnerEngine/Demos/LaneRunner/Scripts/LaneRunner.cs