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

Classes

class  AutoMoveTrackData
 
class  ChildTransformData
 

Public Member Functions

override void _FixedUpdate ()
 
void SnapToTrack (DragTrack newTrack, float positionAlong)
 Snaps the object to a track at a given position along it More...
 
void SnapToTrack (DragTrack newTrack, int regionID)
 Snaps the object to a track at a given region along it More...
 
float GetPositionAlong ()
 Gets how far the object is along its DragTrack. More...
 
override void UpdateMovement ()
 
override void DrawGrabIcon ()
 
override void ApplyDragForce (Vector3 force, Vector3 mousePosition, float _distanceToCamera)
 Applies a drag force on the object, based on the movement of the cursor. More...
 
override void LetGo (bool ignoreInteractions=false)
 
override void Grab (Vector3 grabPosition)
 Attaches the object to the player's control. More...
 
void UpdateScrewVector ()
 
void StopAutoMove (bool snapToTarget=true)
 Stops the object from moving without the player's direct input (i.e. through Actions). More...
 
bool IsAutoMoving (bool beAccurate=true)
 Checks if the object is moving without the player's direct input. More...
 
void AutoMoveAlongTrack (float _targetTrackValue, float _targetTrackSpeed, bool removePlayerControl)
 Forces the object to move along a DragTrack without the player's direct input. More...
 
void AutoMoveAlongTrack (float _targetTrackValue, float _targetTrackSpeed, bool removePlayerControl, LayerMask layerMask, int snapID=-1)
 Forces the object to move along a DragTrack without the player's direct input. More...
 
bool ReferencesAsset (ActionListAsset actionListAsset)
 
List< ActionListAssetGetReferencedActionListAssets ()
 
- Public Member Functions inherited from AC.DragBase
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 ()
 
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...
 
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

DragMode dragMode = DragMode.LockToTrack
 
DragTrack track
 
DragTrackDirection dragTrackDirection = DragTrackDirection.NoRestriction
 
bool retainOriginalTransform = false
 
bool setOnStart = true
 
float trackValueOnStart = 0f
 
bool applyGravity = false
 
ActionListSource actionListSource = ActionListSource.InScene
 
Interaction interactionOnMove = null
 
Interaction interactionOnDrop = null
 
ActionListAsset actionListAssetOnMove = null
 
ActionListAsset actionListAssetOnDrop = null
 
int moveParameterID = -1
 
int dropParameterID = -1
 
AlignDragMovement alignMovement = AlignDragMovement.AlignToCamera
 
Transform plane
 
bool noGravityWhenHeld = true
 
bool moveWithRigidbody = true
 
float simulatedMass = 0.2f
 
bool canCallSnapEvents = true
 
int regionID = 0
 
float toruqeDamping = 10f
 
- Public Attributes inherited from AC.DragBase
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 Start ()
 
override void OnEnable ()
 
override void OnDisable ()
 
void CheckGameplayBlockers ()
 
IEnumerator InitToTrack ()
 
ChildTransformData[] GetChildTransforms ()
 
void SetChildTransforms (ChildTransformData[] childTransformData)
 
void RunInteraction (bool onMove)
 
void OnCollisionEnter (Collision collision)
 
void SetGravity (bool value)
 
- Protected Member Functions inherited from AC.DragBase
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

Vector3 grabPositionRelative
 
float colliderRadius = 0.5f
 
float grabDistance = 0.5f
 
float _trackValue
 
Vector3 _dragVector
 
Collider _maxCollider
 
Collider _minCollider
 
int _revolutions = 0
 
bool canPlayCollideSound = false
 
float screenToWorldOffset
 
float lastFrameTotalCursorPositionAlong
 
bool endLocked = false
 
AutoMoveTrackData activeAutoMove
 
- Protected Attributes inherited from AC.DragBase
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

float ColliderWidth [get]
 
bool UsesRigidbody [get]
 
float trackValue [get, set]
 
Vector3 dragVector [get, set]
 
Collider maxCollider [get, set]
 
Collider minCollider [get, set]
 
int revolutions [get, set]
 
- Properties inherited from AC.DragBase
bool IsHeld [get]
 
- Properties inherited from AC.Moveable
Rigidbody Rigidbody [get]
 
Transform Transform [get]
 

Detailed Description

Attaching this component to a GameObject allows it to be dragged, through physics, according to a set method.

Member Function Documentation

◆ ApplyDragForce()

override void AC.Moveable_Drag.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 from AC.DragBase.

◆ AutoMoveAlongTrack() [1/2]

void AC.Moveable_Drag.AutoMoveAlongTrack ( float  _targetTrackValue,
float  _targetTrackSpeed,
bool  removePlayerControl 
)

Forces the object to move along a DragTrack without the player's direct input.

Parameters
_targetTrackValueThe intended proportion along the track to send the object to
_targetTrackSpeedThe intended speed to move the object by
removePlayerControlIf True and the player is currently moving the object, then player control will be removed

◆ AutoMoveAlongTrack() [2/2]

void AC.Moveable_Drag.AutoMoveAlongTrack ( float  _targetTrackValue,
float  _targetTrackSpeed,
bool  removePlayerControl,
LayerMask  layerMask,
int  snapID = -1 
)

Forces the object to move along a DragTrack without the player's direct input.

Parameters
_targetTrackValueThe intended proportion along the track to send the object to
_targetTrackSpeedThe intended speed to move the object by
removePlayerControlIf True and the player is currently moving the object, then player control will be removed
layerMaskA LayerMask that determines what collisions will cause the automatic movement to cease
snapIDThe ID number of the associated snap, if snapping

◆ DrawGrabIcon()

override void AC.Moveable_Drag.DrawGrabIcon ( )
virtual

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

Reimplemented from AC.DragBase.

◆ GetPositionAlong()

float AC.Moveable_Drag.GetPositionAlong ( )

Gets how far the object is along its DragTrack.

Returns
How far the object is along its DragTrack. This is normally 0 to 1, but if the object is locked to a looped DragTrack_Hinge, then the number of revolutions will be added to the result.

◆ Grab()

override void AC.Moveable_Drag.Grab ( Vector3  grabPosition)
virtual

Attaches the object to the player's control.

Parameters
grabPositionThe point of contact on the object

Reimplemented from AC.DragBase.

◆ IsAutoMoving()

bool AC.Moveable_Drag.IsAutoMoving ( bool  beAccurate = true)

Checks if the object is moving without the player's direct input.

Returns
True if the object is moving without the player's direct input (gravity doesn't count).

◆ LetGo()

override void AC.Moveable_Drag.LetGo ( bool  ignoreInteractions = false)
virtual

Detaches the object from the player's control.

Reimplemented from AC.DragBase.

◆ SnapToTrack() [1/2]

void AC.Moveable_Drag.SnapToTrack ( DragTrack  newTrack,
float  positionAlong 
)

Snaps the object to a track at a given position along it

Parameters
newTrackThe new DragTrack to snap to
positionAlongHow far along the track, as a decimal of its length, to snap to

◆ SnapToTrack() [2/2]

void AC.Moveable_Drag.SnapToTrack ( DragTrack  newTrack,
int  regionID 
)

Snaps the object to a track at a given region along it

Parameters
newTrackThe new DragTrack to snap to
regionIDThe ID of the region to snap to. Regions are defined in the track itself

◆ StopAutoMove()

void AC.Moveable_Drag.StopAutoMove ( bool  snapToTarget = true)

Stops the object from moving without the player's direct input (i.e. through Actions).

Parameters
snapToTargetIf True, then the object will snap instantly to the intended target position

◆ UpdateMovement()

override void AC.Moveable_Drag.UpdateMovement ( )
virtual

Called every frame by StateHandler.

Reimplemented from AC.DragBase.

◆ UpdateScrewVector()

void AC.Moveable_Drag.UpdateScrewVector ( )

If the object rotates like a screw along a DragTrack_Straight, this updates the correct drag vector.

Member Data Documentation

◆ actionListAssetOnDrop

ActionListAsset AC.Moveable_Drag.actionListAssetOnDrop = null

The ActionListAsset to run whenever the object is let go by the player (and actionListSource = ActionListSource.AssetFile)

◆ actionListAssetOnMove

ActionListAsset AC.Moveable_Drag.actionListAssetOnMove = null

The ActionListAsset to run whenever the object is moved by the player (and actionListSource = ActionListSource.AssetFile)

◆ actionListSource

ActionListSource AC.Moveable_Drag.actionListSource = ActionListSource.InScene

Where to locate interactions

◆ alignMovement

AlignDragMovement AC.Moveable_Drag.alignMovement = AlignDragMovement.AlignToCamera

What movement is aligned to, if dragMode = DragMode.MoveAlongPlane (AlignToCamera, AlignToPlane)

◆ applyGravity

bool AC.Moveable_Drag.applyGravity = false

If True, the object will recieve an additional gravity force when not held by the Player or being moved automatically

◆ dragMode

DragMode AC.Moveable_Drag.dragMode = DragMode.LockToTrack

The way in which the object can be dragged (LockedToTrack, MoveAlongPlane, RotateOnly)

◆ dragTrackDirection

DragTrackDirection AC.Moveable_Drag.dragTrackDirection = DragTrackDirection.NoRestriction

Which direction the object can be dragged along the track in

◆ dropParameterID

int AC.Moveable_Drag.dropParameterID = -1

The parameter ID to set as this object in the interactionOnDrop / actionListAssetOnDrop ActionLists

◆ interactionOnDrop

Interaction AC.Moveable_Drag.interactionOnDrop = null

The Interaction to run whenever the object is let go by the player (and actionListSource = ActionListSource.InScene)

◆ interactionOnMove

Interaction AC.Moveable_Drag.interactionOnMove = null

The Interaction to run whenever the object is moved by the player (and actionListSource = ActionListSource.InScene)

◆ moveParameterID

int AC.Moveable_Drag.moveParameterID = -1

The parameter ID to set as this object in the interactionOnMove / actionListAssetOnMove ActionLists

◆ moveWithRigidbody

bool AC.Moveable_Drag.moveWithRigidbody = true

If True, then movement will occur by affecting the Rigidbody, as opposed to directly manipulating the Transform

◆ noGravityWhenHeld

bool AC.Moveable_Drag.noGravityWhenHeld = true

If True, then gravity will be disabled on the object while it is held by the player

◆ plane

Transform AC.Moveable_Drag.plane

The plane to align movement to, if alignMovement = AlignDragMovement.AlignToPlane

◆ retainOriginalTransform

bool AC.Moveable_Drag.retainOriginalTransform = false

If True, and dragMode = DragMode.LockToTrack, then the position and rotation of all child objects will be maintained when the object is attached to the track

◆ setOnStart

bool AC.Moveable_Drag.setOnStart = true

If True, and the object is locked to a DragTrack, then the object will be placed at a specific point along the track when the game begins

◆ simulatedMass

float AC.Moveable_Drag.simulatedMass = 0.2f

The object's simulated mass, if not using a Rigidbody

◆ toruqeDamping

float AC.Moveable_Drag.toruqeDamping = 10f

The amount of damping to apply when rotating an object without a Rigidbody

◆ track

DragTrack AC.Moveable_Drag.track

The DragTrack the object is locked to (if dragMode = DragMode.LockToTrack

◆ trackValueOnStart

float AC.Moveable_Drag.trackValueOnStart = 0f

How far along its DragTrack that the object should be placed at when the game begins