Adventure Creator  1.68.3
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.DragTrack Class Reference
Inheritance diagram for AC.DragTrack:
AC.DragTrack_Curved AC.DragTrack_Hinge AC.DragTrack_Straight

Public Member Functions

virtual void AssignColliders (Moveable_Drag draggable)
 Initialises two end colliders for an object that prevent it from moving beyond the track. More...
 
virtual float GetDecimalAlong (Moveable_Drag draggable)
 Gets the proportion along the track that an object is positioned. More...
 
virtual void SetPositionAlong (float proportionAlong, Moveable_Drag draggable)
 Positions an object on a specific point along the track. More...
 
virtual void Connect (Moveable_Drag draggable)
 Connects an object to the track when the game begins. More...
 
virtual void ApplyDragForce (Vector3 force, Moveable_Drag draggable)
 Applies a force to an object connected to the track. More...
 
virtual void ApplyAutoForce (float _position, float _speed, Moveable_Drag draggable)
 Applies a force that, when applied every frame, pushes an object connected to the track towards a specific point along it. More...
 
virtual void UpdateDraggable (Moveable_Drag draggable)
 Updates the position of an object connected to the track. This is called every frame. More...
 
virtual void SnapToTrack (Moveable_Drag draggable, bool onStart)
 Corrects the position of an object so that it is placed along the track. More...
 
virtual bool IconIsStationary ()
 Checks if the icon that can display when an object is moved along the track remains in the same place as the object moves. More...
 

Public Attributes

PhysicMaterial colliderMaterial
 
float discSize = 0.2f
 
Color handleColour = Color.white
 

Protected Member Functions

void LimitCollisions (Moveable_Drag draggable)
 

Detailed Description

The base class for "tracks", which are used to contrain Moveable_Drag objects along a pre-determined path

Member Function Documentation

◆ ApplyAutoForce()

virtual void AC.DragTrack.ApplyAutoForce ( float  _position,
float  _speed,
Moveable_Drag  draggable 
)
virtual

Applies a force that, when applied every frame, pushes an object connected to the track towards a specific point along it.

Parameters
_positionThe proportiona along which to place the Moveable_Drag object (0 to 1)

Reimplemented in AC.DragTrack_Straight, AC.DragTrack_Curved, and AC.DragTrack_Hinge.

◆ ApplyDragForce()

virtual void AC.DragTrack.ApplyDragForce ( Vector3  force,
Moveable_Drag  draggable 
)
virtual

Applies a force to an object connected to the track.

Parameters
forceThe drag force vector input by the player
draggableThe Moveable_Drag object to apply the force to

Reimplemented in AC.DragTrack_Straight, AC.DragTrack_Curved, and AC.DragTrack_Hinge.

◆ AssignColliders()

virtual void AC.DragTrack.AssignColliders ( Moveable_Drag  draggable)
virtual

Initialises two end colliders for an object that prevent it from moving beyond the track.

Parameters
draggableThe Moveable_Drag object to create colliders for

Reimplemented in AC.DragTrack_Hinge, AC.DragTrack_Curved, and AC.DragTrack_Straight.

◆ Connect()

virtual void AC.DragTrack.Connect ( Moveable_Drag  draggable)
virtual

Connects an object to the track when the game begins.

Parameters
draggableThe Moveable_Drag object to connect to the track

Reimplemented in AC.DragTrack_Curved, AC.DragTrack_Straight, and AC.DragTrack_Hinge.

◆ GetDecimalAlong()

virtual float AC.DragTrack.GetDecimalAlong ( Moveable_Drag  draggable)
virtual

Gets the proportion along the track that an object is positioned.

Parameters
draggableThe Moveable_Drag object to check the position of
Returns
The proportion along the track that the Moveable_Drag object is positioned (0 to 1)

Reimplemented in AC.DragTrack_Curved, AC.DragTrack_Hinge, and AC.DragTrack_Straight.

◆ IconIsStationary()

virtual bool AC.DragTrack.IconIsStationary ( )
virtual

Checks if the icon that can display when an object is moved along the track remains in the same place as the object moves.

Returns
True if the icon remains in the same place (always False unless overridden by subclasses)

Reimplemented in AC.DragTrack_Straight.

◆ SetPositionAlong()

virtual void AC.DragTrack.SetPositionAlong ( float  proportionAlong,
Moveable_Drag  draggable 
)
virtual

Positions an object on a specific point along the track.

Parameters
proportionAlongThe proportion along which to place the Moveable_Drag object (0 to 1)
draggableThe Moveable_Drag object to reposition

Reimplemented in AC.DragTrack_Hinge, AC.DragTrack_Curved, and AC.DragTrack_Straight.

◆ SnapToTrack()

virtual void AC.DragTrack.SnapToTrack ( Moveable_Drag  draggable,
bool  onStart 
)
virtual

Corrects the position of an object so that it is placed along the track.

Parameters
draggableThe Moveable_Drag object to snap onto the track
onStartIs True if the game has just begun (i.e. this function is being run for the first time)

Reimplemented in AC.DragTrack_Curved, AC.DragTrack_Hinge, and AC.DragTrack_Straight.

◆ UpdateDraggable()

virtual void AC.DragTrack.UpdateDraggable ( Moveable_Drag  draggable)
virtual

Updates the position of an object connected to the track. This is called every frame.

Parameters
draggableThe Moveable_Drag object to update the position of

Reimplemented in AC.DragTrack_Curved, AC.DragTrack_Straight, and AC.DragTrack_Hinge.

Member Data Documentation

◆ colliderMaterial

PhysicMaterial AC.DragTrack.colliderMaterial

The Physics Material to give the track's end colliders

◆ discSize

float AC.DragTrack.discSize = 0.2f

The size of the track's end colliders, as seen in the Scene window

◆ handleColour

Color AC.DragTrack.handleColour = Color.white

The colour of Scene window Handles