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

Public Member Functions

virtual void UpdateMovement ()
 
virtual void _FixedUpdate ()
 
bool IsOn (bool accountForCamera=false)
 
void TurnOn ()
 
void TurnOn (bool manualSet)
 Makes the object interactive. More...
 
void TurnOff ()
 
void TurnOff (bool manualSet)
 Disables the Hotspot. More...
 
virtual bool CanToggleCursor ()
 
virtual void DrawGrabIcon ()
 
virtual void Grab (Vector3 grabPosition)
 Attaches the object to the player's control. More...
 
virtual void LetGo (bool ignoreInteractions=false)
 
bool CanGrab ()
 
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...
 
bool PlayerIsWithinBoundary ()
 Checks if the Player is within the draggables's interactableBoundary, if assigned. More...
 
Vector3 GetGrabPosition ()
 Gets the point of contact on the object, once grabbed. More...
 
- Public Member Functions inherited from AC.Moveable
void StopMoving ()
 
bool IsMoving (TransformType transformType)
 
bool IsMoving ()
 
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...
 
Vector3 GetTargetPosition ()
 

Public Attributes

InteractiveBoundary interactiveBoundary
 
_Camera limitToCamera = null
 
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
 
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
 
OffScreenRelease offScreenRelease = OffScreenRelease.GrabPoint
 
Sound moveSound
 
- Public Attributes inherited from AC.Moveable
bool predictCollisions
 

Protected Member Functions

override void Awake ()
 
override void OnEnable ()
 
virtual void Start ()
 
override void OnDisable ()
 
void OnCollisionExit (Collision collision)
 
void OnSwitchCamera (_Camera oldCamera, _Camera newCamera, float transitionTime)
 
void LimitToActiveCamera (_Camera _camera)
 
void PlaceOnLayer (int layerName)
 
void BaseOnCollisionEnter (Collision collision)
 
void PlayMoveSound (float speed)
 
void UpdateZoom ()
 
void LimitZoom ()
 
CursorIconBase GetMainIcon ()
 
void LimitCollisions ()
 
- Protected Member Functions inherited from AC.Moveable
void Update ()
 
void Kill ()
 

Protected Attributes

bool isHeld = false
 
Transform grabPoint
 
float distanceToCamera
 
float speedFactor = 0.16f
 
float originalDrag
 
float originalAngularDrag
 
int numCollisions = 0
 
CursorIconBase icon
 
Sound collideSound
 
bool isOn = true
 
- Protected Attributes inherited from AC.Moveable
float positionChangeTime
 
float positionStartTime
 
AnimationCurve positionTimeCurve
 
MoveMethod positionMethod
 
Vector3 startPosition
 
Vector3 endPosition
 
bool inWorldSpace
 
float rotateChangeTime
 
float rotateStartTime
 
AnimationCurve rotateTimeCurve
 
MoveMethod rotateMethod
 
bool doEulerRotation = false
 
Vector3 startEulerRotation
 
Vector3 endEulerRotation
 
Quaternion startRotation
 
Quaternion endRotation
 
float scaleChangeTime
 
float scaleStartTime
 
AnimationCurve scaleTimeCurve
 
MoveMethod scaleMethod
 
Vector3 startScale
 
Vector3 endScale
 
Char character
 
Rigidbody _rigidbody
 
Rigidbody2D _rigidbody2D
 

Properties

bool IsHeld [get]
 
- Properties inherited from AC.Moveable
Rigidbody Rigidbody [get]
 
Transform Transform [get]
 

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.

◆ CanGrab()

bool AC.DragBase.CanGrab ( )

Checks if the object can currently be grabbed

◆ 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 ( bool  ignoreInteractions = false)
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() [1/2]

void AC.DragBase.TurnOff ( )

Makes the object non-interactive.

◆ TurnOff() [2/2]

void AC.DragBase.TurnOff ( bool  manualSet)

Disables the Hotspot.

Parameters
manualSetIf True, then the Hotspot will be considered 'Off" when saving

◆ TurnOn() [1/2]

void AC.DragBase.TurnOn ( )

Makes the object interactive.

◆ TurnOn() [2/2]

void AC.DragBase.TurnOn ( bool  manualSet)

Makes the object interactive.

Parameters
manualSetIf True, then the object will be considered 'On" when saving

◆ UpdateMovement()

virtual void AC.DragBase.UpdateMovement ( )
virtual

Called every frame by StateHandler.

Reimplemented in AC.Moveable_Drag, and AC.Moveable_PickUp.

Member Data Documentation

◆ 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 boundary 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 draggable 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

◆ limitToCamera

_Camera AC.DragBase.limitToCamera = null

If assigned, then the draggable will only be interactive when the assigned _Camera is active

◆ 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)

◆ moveSound

Sound AC.DragBase.moveSound

The Sound component to play move sounds from

◆ moveSoundClip

AudioClip AC.DragBase.moveSoundClip

The sound to play when the object is moved

◆ offScreenRelease

OffScreenRelease AC.DragBase.offScreenRelease = OffScreenRelease.GrabPoint

What should cause the object to be automatically released if it leaves the screen

◆ 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)

Property Documentation

◆ IsHeld

bool AC.DragBase.IsHeld
get

If True, the object is currently held by the player