Adventure Creator  1.66.8
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.DragBase Class Reference
Inheritance diagram for AC.DragBase:
AC.Moveable AC.Moveable_Drag AC.Moveable_PickUp

Public Member Functions

void TurnOn ()
 
void TurnOff ()
 
virtual void UpdateMovement ()
 
virtual bool CanToggleCursor ()
 
virtual void DrawGrabIcon ()
 
virtual void Grab (Vector3 grabPosition)
 Attaches the object to the player's control. More...
 
virtual void LetGo ()
 
bool IsOnScreen ()
 Checks if the the point of contact is visible on-screen. More...
 
bool IsCloseToCamera (float maxDistance)
 Checks if the point of contact is close enough to the camera to continue being held. More...
 
virtual void ApplyDragForce (Vector3 force, Vector3 mousePosition, float distanceToCamera)
 Applies a drag force on the object, based on the movement of the cursor. More...
 
Vector3 GetGrabPosition ()
 Gets the point of contact on the object, once grabbed. More...
 
bool PlayerIsWithinBoundary ()
 Checks if the Player is within the draggables's interactableBoundary, if assigned. More...
 
- Public Member Functions inherited from AC.Moveable
void StopMoving ()
 
bool IsMoving (TransformType transformType)
 
void EndMovement ()
 
void Move (Vector3 _newVector, MoveMethod _moveMethod, bool _inWorldSpace, float _transitionTime, TransformType _transformType, bool _doEulerRotation, AnimationCurve _timeCurve, bool clearExisting)
 Moves the GameObject by referencing a Vector3 as its target Transform. More...
 
void Move (Marker _marker, MoveMethod _moveMethod, bool _inWorldSpace, float _transitionTime, AnimationCurve _timeCurve)
 Moves the GameObject by referencing a Marker component as its target Transform. More...
 
MoveableData SaveData (MoveableData saveData)
 Updates a MoveableData class with its own variables that need saving. More...
 
void LoadData (MoveableData saveData)
 Updates its own variables from a MoveableData class. More...
 

Public Attributes

InteractiveBoundary interactiveBoundary
 
bool isHeld = false
 
bool invertInput = false
 
float maxSpeed = 200f
 
float playerMovementReductionFactor = 0f
 
float playerMovementInfluence = 1f
 
bool allowZooming = false
 
float zoomSpeed = 60f
 
float minZoom = 1f
 
float maxZoom = 3f
 
float rotationFactor = 1f
 
Rigidbody _rigidbody
 
bool showIcon = false
 
int iconID = -1
 
AudioClip moveSoundClip
 
AudioClip collideSoundClip
 
float slideSoundThreshold = 0.03f
 
float slidePitchFactor = 1f
 
bool onlyPlayLowerCollisionSound = false
 
bool ignoreMoveableRigidbodies
 
bool ignorePlayerCollider
 
bool childrenShareLayer
 

Protected Member Functions

virtual void Awake ()
 
virtual void Start ()
 
void BaseOnCollisionEnter (Collision collision)
 
void PlayMoveSound (float speed, float trackValue)
 
void UpdateZoom ()
 
void LimitZoom ()
 

Protected Attributes

Transform grabPoint
 
Transform cameraTransform
 
float distanceToCamera
 
float speedFactor = 0.16f
 
float originalDrag
 
float originalAngularDrag
 
int numCollisions = 0
 
CursorIconBase icon
 
Sound collideSound
 
Sound moveSound
 

Detailed Description

The base class of objects that can be picked up and moved around with the mouse / touch.

Member Function Documentation

◆ ApplyDragForce()

virtual void AC.DragBase.ApplyDragForce ( Vector3  force,
Vector3  mousePosition,
float  distanceToCamera 
)
virtual

Applies a drag force on the object, based on the movement of the cursor.

Parameters
forceThe force vector to apply
mousePositionThe position of the mouse
distanceToCameraThe distance between the object's centre and the camera

Reimplemented in AC.Moveable_Drag, and AC.Moveable_PickUp.

◆ CanToggleCursor()

virtual bool AC.DragBase.CanToggleCursor ( )
virtual

If True, 'ToggleCursor' can be used while the object is held.

Reimplemented in AC.Moveable_PickUp.

◆ DrawGrabIcon()

virtual void AC.DragBase.DrawGrabIcon ( )
virtual

Draws an icon at the point of contact on the object, if appropriate.

Reimplemented in AC.Moveable_Drag.

◆ GetGrabPosition()

Vector3 AC.DragBase.GetGrabPosition ( )

Gets the point of contact on the object, once grabbed.

Returns
The point of contact on the object, once grabbed

◆ Grab()

virtual void AC.DragBase.Grab ( Vector3  grabPosition)
virtual

Attaches the object to the player's control.

Parameters
grabPositionThe point of contact on the object

Reimplemented in AC.Moveable_Drag, and AC.Moveable_PickUp.

◆ IsCloseToCamera()

bool AC.DragBase.IsCloseToCamera ( float  maxDistance)

Checks if the point of contact is close enough to the camera to continue being held.

Parameters
maxDistanceThe maximum-allowed distance between the point of contact and the camera

◆ IsOnScreen()

bool AC.DragBase.IsOnScreen ( )

Checks if the the point of contact is visible on-screen.

Returns
True if the point of contact is visible on-screen.

◆ LetGo()

virtual void AC.DragBase.LetGo ( )
virtual

Detaches the object from the player's control.

Reimplemented in AC.Moveable_Drag, and AC.Moveable_PickUp.

◆ PlayerIsWithinBoundary()

bool AC.DragBase.PlayerIsWithinBoundary ( )

Checks if the Player is within the draggables's interactableBoundary, if assigned.

Returns
True if the Player is within the draggables's interactableBoundary, if assigned. If no InteractableBoundary is assigned, or there is no Player, then True will be returned.

◆ TurnOff()

void AC.DragBase.TurnOff ( )

Makes the object non-interactive.

◆ TurnOn()

void AC.DragBase.TurnOn ( )

Makes the object interactive.

◆ UpdateMovement()

virtual void AC.DragBase.UpdateMovement ( )
virtual

Called every frame by StateHandler.

Reimplemented in AC.Moveable_Drag, and AC.Moveable_PickUp.

Member Data Documentation

◆ _rigidbody

Rigidbody AC.DragBase._rigidbody

The object's Rigidbody, assigned automaticaly but read by other scripts

◆ allowZooming

bool AC.DragBase.allowZooming = false

If True, the object can be moved towards and away from the camera

◆ childrenShareLayer

bool AC.DragBase.childrenShareLayer

If True, then this object's children will be placed on the same layer

◆ collideSoundClip

AudioClip AC.DragBase.collideSoundClip

The sound to play when the object has a collision

◆ iconID

int AC.DragBase.iconID = -1

The ID number of the CursorIcon that gets shown if showIcon = true, as defined in CursorManager's cursorIcons List

◆ ignoreMoveableRigidbodies

bool AC.DragBase.ignoreMoveableRigidbodies

If True, then the Physics system will ignore collisions between this object and the bounday colliders of any DragTrack that this is not locked to

◆ ignorePlayerCollider

bool AC.DragBase.ignorePlayerCollider

If True, then the Physics system will ignore collisions between this object and the player

◆ interactiveBoundary

InteractiveBoundary AC.DragBase.interactiveBoundary

If assigned, then the Hotspot will only be interactive when the player is within this Trigger Collider's boundary

◆ invertInput

bool AC.DragBase.invertInput = false

If True, input vectors will be inverted

◆ isHeld

bool AC.DragBase.isHeld = false

If True, the object is currently held by the player

◆ maxSpeed

float AC.DragBase.maxSpeed = 200f

The maximum force magnitude that can be applied to itself

◆ maxZoom

float AC.DragBase.maxZoom = 3f

The maxiumum distance that there can be between the object and the camera (if allowZooming = True)

◆ minZoom

float AC.DragBase.minZoom = 1f

The minimum distance that there can be between the object and the camera (if allowZooming = True)

◆ moveSoundClip

AudioClip AC.DragBase.moveSoundClip

The sound to play when the object is moved

◆ onlyPlayLowerCollisionSound

bool AC.DragBase.onlyPlayLowerCollisionSound = false

If True, then the collision sound will only play when the object collides with its lower boundary collider

◆ playerMovementInfluence

float AC.DragBase.playerMovementInfluence = 1f

The influence that player movement has on the drag force

◆ playerMovementReductionFactor

float AC.DragBase.playerMovementReductionFactor = 0f

How much player movement is reduced by when the object is being dragged

◆ rotationFactor

float AC.DragBase.rotationFactor = 1f

The speed by which the object can be rotated

◆ showIcon

bool AC.DragBase.showIcon = false

If True, then an icon will be displayed at the "grab point" when the object is held

◆ slidePitchFactor

float AC.DragBase.slidePitchFactor = 1f

The factor by which the movement sound's pitch is adjusted in relation to speed

◆ slideSoundThreshold

float AC.DragBase.slideSoundThreshold = 0.03f

The minimum speed that the object must be moving by for sound to play

◆ zoomSpeed

float AC.DragBase.zoomSpeed = 60f

The speed at which the object can be moved towards and away from the camera (if allowZooming = True)