Highroad Engine v1.3
Public Types | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | List of all members
MoreMountains.HighroadEngine.CarController Class Reference

Car controller class. Manages inputs from InputManager and driving evaluation You can customize the car properties for different types of cars More...

Inheritance diagram for MoreMountains.HighroadEngine.CarController:
MoreMountains.HighroadEngine.BaseController MoreMountains.HighroadEngine.IActorInput

Public Types

enum  Gears { forward , reverse }
 Gears enum. Car can be forward driving or backward driving (reverse) More...
 

Public Attributes

float MaximumVelocity = 20f
 the car's maximum speed More...
 
float Acceleration = 100f
 the engine's force More...
 
float BrakeForce = 10f
 the intensity of the brakes More...
 
float OffroadFactor = 2f
 the penalty applied when going offroad More...
 
Vector3 CenterOfMass = new Vector3(0,-1,0)
 
float CarGroundDistance = 0.1f
 
- Public Attributes inherited from MoreMountains.HighroadEngine.BaseController
float BoostForce = 1f
 the force applied when the vehicle is in a boost zone More...
 
float RigidBodyDragInLoop = 1f
 The temporary value of rigidbody.drag when the vehicle is inside a loop zone. This allows for better movement inside the loop. More...
 
float SteeringSpeed = 100f
 the speed at which the car steers More...
 
bool AutoForward = false
 Set this to true if you want the vehicle to accelerate forever. More...
 

Protected Member Functions

override void Awake ()
 Physics initialization More...
 
virtual void Update ()
 Update More...
 
virtual void ShowDebugInformation ()
 Shows the debug information. Optionnal. Can be used during tests to show vehicle values More...
 
virtual void UpdateGroundSituation ()
 Updates the ground situation for this car. More...
 
virtual void FixedUpdate ()
 Fixed update. We apply physics and input evaluation. More...
 
virtual void Accelerate ()
 Manages the acceleration of the car (forward or reverse) More...
 
virtual void Brake ()
 Brake force More...
 
virtual void Steer ()
 Steer evaluation. We get steering value and apply rotation accordingly More...
 
- Protected Member Functions inherited from MoreMountains.HighroadEngine.BaseController
virtual void Start ()
 Initializes checkpoints More...
 

Protected Attributes

Vector3 _currentVelocity
 Current car velocity. More...
 
float _distanceToTheGroundRaycastLength = 50f
 
Vector3 _gravity = new Vector3(0,-30,0)
 
- Protected Attributes inherited from MoreMountains.HighroadEngine.BaseController
Rigidbody _rigidbody
 
Collider _collider
 
RaceManager _raceManager
 
Transform[] _checkpoints
 
int _currentWaypoint = 0
 
int _lastWaypointCrossed = -1
 
float _defaultDrag
 
int _controllerId = -1
 
int _finisherPosition = 0
 αΊ€hen > 0, vehicle has finished the race. This is it final rank. More...
 
float _currentGasPedalAmount
 

Static Protected Attributes

const float _smallValue = 0.01f
 
const float _minimalGasPedalValue = 20f
 

Properties

Gears CurrentGear [getprotected set]
 The current gear value. More...
 
virtual float DistanceToTheGround [getset]
 Gets or sets the distance to the ground. More...
 
virtual GameObject GroundGameObject [getset]
 Gets or sets the ground game object. More...
 
virtual bool IsOffRoad [get]
 Gets a value indicating whether this car is off road. More...
 
virtual float NormalizedSpeed [get]
 Gets the normalized speed. More...
 
- Properties inherited from MoreMountains.HighroadEngine.BaseController
int CurrentLap [getprotected set]
 Returns the current lap. More...
 
float CurrentSteeringAmount [getset]
 Gets or sets the current steering amount from -1 (full left) to 1 (full right). 0 when none. More...
 
float? CurrentGasPedalAmount [getset]
 Gets or sets the current gas pedal amount. 1 for full acceleration. -1 for full brake or reverse. 0 for nothing. More...
 
virtual bool IsPlaying [getprotected set]
 Gets or sets a value indicating whether this user is playing. More...
 
virtual bool IsGrounded [getprotected set]
 Gets or sets a value indicating whether this instance is grounded. More...
 
virtual bool IsOnSpeedBoost [getprotected set]
 Gets or sets a value indicating whether this instance is on speed boost. More...
 
virtual float Speed [get]
 Gets the vehicle speed. More...
 
virtual int Score [get]
 Gets the player score. More...
 
virtual float DistanceToNextWaypoint [get]
 Gets the distance to the next waypoint. More...
 
int FinalRank [get]
 Gets the final rank. 0 if vehicle has not ended. More...
 

Additional Inherited Members

- Public Member Functions inherited from MoreMountains.HighroadEngine.BaseController
virtual bool HasJustFinished (int finalRankPosition)
 Gets a value indicating whether this vehicle has just finished the race. This property will return true only once. More...
 
virtual void MainActionPressed ()
 Button Main Action is being pressed More...
 
virtual void MainActionDown ()
 Button Main Action is pressed down More...
 
virtual void MainActionReleased ()
 Button Main Action is released More...
 
virtual void AltActionPressed ()
 Button Alt Action is being pressed More...
 
virtual void AltActionDown ()
 Button Alt Action is pressed down More...
 
virtual void AltActionReleased ()
 Button Alt Action is released More...
 
virtual void RespawnActionPressed ()
 Button Respawn Action is being pressed More...
 
virtual void RespawnActionDown ()
 Button Respawn Action is pressed down More...
 
virtual void RespawnActionReleased ()
 Button Respawn Action is released More...
 
virtual void LeftPressed ()
 Button Left is being pressed More...
 
virtual void RightPressed ()
 Button Right is being pressed More...
 
virtual void UpPressed ()
 Button Up is being pressed More...
 
virtual void DownPressed ()
 Button Down is being pressed More...
 
virtual void MobileJoystickPosition (Vector2 value)
 Update of the mobile joystick position More...
 
virtual void HorizontalPosition (float value)
 Update of the horizontal value (from -1 to 1) More...
 
virtual void VerticalPosition (float value)
 Update of the vertical value (from -1 to 1) More...
 
virtual void LeftReleased ()
 Button Left is released More...
 
virtual void RightReleased ()
 Button Right is released More...
 
virtual void UpReleased ()
 Button Up is released More...
 
virtual void DownReleased ()
 Button Down is released More...
 
virtual void Respawn ()
 This method triggers the respawn of the vehicle to its last checkpoint More...
 
virtual void OnTriggerEnter (Collider other)
 Describes what happens when the object starts colliding with something Used for checkpoint interaction More...
 
virtual void OnTriggerStay (Collider other)
 Describes what happens when something is colliding with our object Used to apply a boost force to the vehicle while staying in a boost zone. More...
 
virtual void OnTriggerExit (Collider other)
 Describes what happens when the collision ends Removes "boost" state when the vehicle exits a boost zone More...
 
virtual void EnableControls (int controllerId)
 Enables the controls. More...
 
virtual void DisableControls ()
 Disables the controls. More...
 
- Protected Types inherited from MoreMountains.HighroadEngine.BaseController
enum  Zones { SpeedBoost , JumpBoost , LoopZone }
 

Detailed Description

Car controller class. Manages inputs from InputManager and driving evaluation You can customize the car properties for different types of cars

Member Enumeration Documentation

◆ Gears

Gears enum. Car can be forward driving or backward driving (reverse)

Enumerator
forward 
reverse 

Member Function Documentation

◆ Accelerate()

virtual void MoreMountains.HighroadEngine.CarController.Accelerate ( )
protectedvirtual

Manages the acceleration of the car (forward or reverse)

◆ Awake()

override void MoreMountains.HighroadEngine.CarController.Awake ( )
protectedvirtual

Physics initialization

Reimplemented from MoreMountains.HighroadEngine.BaseController.

◆ Brake()

virtual void MoreMountains.HighroadEngine.CarController.Brake ( )
protectedvirtual

Brake force

◆ FixedUpdate()

virtual void MoreMountains.HighroadEngine.CarController.FixedUpdate ( )
protectedvirtual

Fixed update. We apply physics and input evaluation.

◆ ShowDebugInformation()

virtual void MoreMountains.HighroadEngine.CarController.ShowDebugInformation ( )
protectedvirtual

Shows the debug information. Optionnal. Can be used during tests to show vehicle values

◆ Steer()

virtual void MoreMountains.HighroadEngine.CarController.Steer ( )
protectedvirtual

Steer evaluation. We get steering value and apply rotation accordingly

◆ Update()

virtual void MoreMountains.HighroadEngine.CarController.Update ( )
protectedvirtual

Update

◆ UpdateGroundSituation()

virtual void MoreMountains.HighroadEngine.CarController.UpdateGroundSituation ( )
protectedvirtual

Updates the ground situation for this car.

Member Data Documentation

◆ _currentVelocity

Vector3 MoreMountains.HighroadEngine.CarController._currentVelocity
protected

Current car velocity.

◆ _distanceToTheGroundRaycastLength

float MoreMountains.HighroadEngine.CarController._distanceToTheGroundRaycastLength = 50f
protected

◆ _gravity

Vector3 MoreMountains.HighroadEngine.CarController._gravity = new Vector3(0,-30,0)
protected

◆ _minimalGasPedalValue

const float MoreMountains.HighroadEngine.CarController._minimalGasPedalValue = 20f
staticprotected

◆ _smallValue

const float MoreMountains.HighroadEngine.CarController._smallValue = 0.01f
staticprotected

◆ Acceleration

float MoreMountains.HighroadEngine.CarController.Acceleration = 100f

the engine's force

◆ BrakeForce

float MoreMountains.HighroadEngine.CarController.BrakeForce = 10f

the intensity of the brakes

◆ CarGroundDistance

float MoreMountains.HighroadEngine.CarController.CarGroundDistance = 0.1f

◆ CenterOfMass

Vector3 MoreMountains.HighroadEngine.CarController.CenterOfMass = new Vector3(0,-1,0)

◆ MaximumVelocity

float MoreMountains.HighroadEngine.CarController.MaximumVelocity = 20f

the car's maximum speed

◆ OffroadFactor

float MoreMountains.HighroadEngine.CarController.OffroadFactor = 2f

the penalty applied when going offroad

Property Documentation

◆ CurrentGear

Gears MoreMountains.HighroadEngine.CarController.CurrentGear
getprotected set

The current gear value.

◆ DistanceToTheGround

virtual float MoreMountains.HighroadEngine.CarController.DistanceToTheGround
getsetprotected

Gets or sets the distance to the ground.

The distance to the ground.

◆ GroundGameObject

virtual GameObject MoreMountains.HighroadEngine.CarController.GroundGameObject
getsetprotected

Gets or sets the ground game object.

The ground game object.

◆ IsOffRoad

virtual bool MoreMountains.HighroadEngine.CarController.IsOffRoad
get

Gets a value indicating whether this car is off road.

true if this instance is off road; otherwise, false.

◆ NormalizedSpeed

virtual float MoreMountains.HighroadEngine.CarController.NormalizedSpeed
get

Gets the normalized speed.

The normalized speed.


The documentation for this class was generated from the following file: