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

Public Member Functions

QTEState GetState ()
 Gets the current QTE state (None, Win, Lose, Running) More...
 
void SkipQTE ()
 
void KillQTE ()
 
void StartSinglePressQTE (string _inputName, float _duration, Animator _animator=null, bool _wrongKeyFails=false)
 Begins a QTE that involves a single key being pressed to win. More...
 
void StartSingleAxisQTE (string _inputName, float _duration, float _axisThreshold, Animator _animator=null, bool _wrongKeyFails=false)
 Begins a QTE that involves a single axis being pressed to win. More...
 
void StartHoldKeyQTE (string _inputName, float _duration, float _holdDuration, QTEHoldReleaseBehaviour _qteHoldReleaseBehaviour=QTEHoldReleaseBehaviour.Reset, Animator _animator=null, bool _wrongKeyFails=false)
 Begins a QTE that involves a single key being held down to win. More...
 
void StartButtonMashQTE (string _inputName, float _duration, int _targetPresses, bool _doCooldown, float _cooldownTime, Animator _animator=null, bool _wrongKeyFails=false)
 Begins a QTE that involves a single key being pressed repeatedly to win. More...
 
void StartThumbstickRotationQTE (string _horizontalInputName, string _verticalInputName, float _duration, float _targetRotations, bool _rotationIsClockwise, Animator _animator=null, bool _wrongDirectionFails=false)
 Begins a QTE that involves rotating two input axes to win. More...
 
float GetRemainingTimeFactor ()
 Gets the time factor remaining in the current QTE, as a decimal. More...
 
float GetProgress ()
 Gets the progress made towards completing the current QTE, as a decimal. More...
 
bool QTEIsActive ()
 Checks if a QTE sequence is currently active. More...
 
void UpdateQTE ()
 

Protected Member Functions

void Setup (QTEType _qteType, string _inputName, float _duration, Animator _animator, bool _wrongKeyFails, float _axisThreshold)
 
virtual void Win ()
 
virtual void Lose ()
 

Protected Attributes

QTEState qteState = QTEState.None
 
QTEType qteType = QTEType.SingleKeypress
 
QTEHoldReleaseBehaviour qteHoldReleaseBehaviour
 
string inputName
 
Animator animator
 
bool wrongKeyFails
 
float holdDuration
 
float cooldownTime
 
int targetPresses
 
bool doCooldown
 
float progress
 
int numPresses
 
float startTime
 
float endTime
 
float lastPressTime
 
bool canMash
 
float axisThreshold
 
bool isIndefinite
 
string verticalInputName
 
bool rotationIsClockwise
 
float targetRotations
 
float currentRotations
 
float maxRotation
 
Vector2 lastFrameRotationInput
 

Static Protected Attributes

const string touchScreenTap = "TOUCHSCREENTAP"
 

Detailed Description

This script handles the state, input and progress of Quick Time Events (QTEs). It should be attached to the GameEngine prefab.

Member Function Documentation

◆ GetProgress()

float AC.PlayerQTE.GetProgress ( )

Gets the progress made towards completing the current QTE, as a decimal.

Returns
The progress made towards competing the current QTE, as a decimal

◆ GetRemainingTimeFactor()

float AC.PlayerQTE.GetRemainingTimeFactor ( )

Gets the time factor remaining in the current QTE, as a decimal.

Returns
The time factor remaining in the current QTE, as a decimal

◆ GetState()

QTEState AC.PlayerQTE.GetState ( )

Gets the current QTE state (None, Win, Lose, Running)

Returns
The current QTE state (None, Win, Lose, Running)

◆ KillQTE()

void AC.PlayerQTE.KillQTE ( )

Automatically end the current QTE.

◆ QTEIsActive()

bool AC.PlayerQTE.QTEIsActive ( )

Checks if a QTE sequence is currently active.

Returns
True if a QTE sequence is currently active.

◆ SkipQTE()

void AC.PlayerQTE.SkipQTE ( )

Automatically wins the current QTE.

◆ StartButtonMashQTE()

void AC.PlayerQTE.StartButtonMashQTE ( string  _inputName,
float  _duration,
int  _targetPresses,
bool  _doCooldown,
float  _cooldownTime,
Animator  _animator = null,
bool  _wrongKeyFails = false 
)

Begins a QTE that involves a single key being pressed repeatedly to win.

Parameters
_inputNameThe name of the input button that must be pressed repeatedly to win
_durationThe duration, in seconds, that the QTE lasts
_targetPressesThe number of times that the key must be pressed to win
_doCooldownIf True, then the number of registered key-presses will decrease over time
_cooldownTimeThe cooldown time, if _doCooldown = True
_animatorAn Animator that will be manipulated if it has "Hit", "Win" and "Lose" states
_wrongKeyFailsIf True, then pressing any key other than _inputName will instantly fail the QTE

◆ StartHoldKeyQTE()

void AC.PlayerQTE.StartHoldKeyQTE ( string  _inputName,
float  _duration,
float  _holdDuration,
QTEHoldReleaseBehaviour  _qteHoldReleaseBehaviour = QTEHoldReleaseBehaviour.Reset,
Animator  _animator = null,
bool  _wrongKeyFails = false 
)

Begins a QTE that involves a single key being held down to win.

Parameters
_inputNameThe name of the input button that must be held down to win
_durationThe duration, in seconds, that the QTE lasts
_holdDurationThe duration, in seconds, that the key must be held down for
_qteHoldReleaseBehaviourWhat happens if the key is released
_animatorAn Animator that will be manipulated if it has "Win" and "Lose" states, and a "Held" trigger
_wrongKeyFailsIf True, then pressing any key other than _inputName will instantly fail the QTE

◆ StartSingleAxisQTE()

void AC.PlayerQTE.StartSingleAxisQTE ( string  _inputName,
float  _duration,
float  _axisThreshold,
Animator  _animator = null,
bool  _wrongKeyFails = false 
)

Begins a QTE that involves a single axis being pressed to win.

Parameters
_inputNameThe name of the input axis that must be pressed to win
_durationThe duration, in seconds, that the QTE lasts
_axisThresholdIf positive, the value that the input must be greater than for it to register as succesful. If positive, the input must be lower that this value.
_animatorAn Animator that will be manipulated if it has "Win" and "Lose" states
_wrongKeyFailsIf True, then pressing any axis other than _inputName will instantly fail the QTE

◆ StartSinglePressQTE()

void AC.PlayerQTE.StartSinglePressQTE ( string  _inputName,
float  _duration,
Animator  _animator = null,
bool  _wrongKeyFails = false 
)

Begins a QTE that involves a single key being pressed to win.

Parameters
_inputNameThe name of the input button that must be pressed to win
_durationThe duration, in seconds, that the QTE lasts
_animatorAn Animator that will be manipulated if it has "Win" and "Lose" states
_wrongKeyFailsIf True, then pressing any key other than _inputName will instantly fail the QTE

◆ StartThumbstickRotationQTE()

void AC.PlayerQTE.StartThumbstickRotationQTE ( string  _horizontalInputName,
string  _verticalInputName,
float  _duration,
float  _targetRotations,
bool  _rotationIsClockwise,
Animator  _animator = null,
bool  _wrongDirectionFails = false 
)

Begins a QTE that involves rotating two input axes to win.

Parameters
_horizontalInputNameThe name of the horizontal input axis
_verticalInputNameThe name of the vertical input axis
_durationThe duration, in seconds, that the QTE lasts
_targetRotationsHow many revolutions the input must be rotated by
_rotationIsClockwiseIf true, input is required to be clockwise. Otherwise, it must be anti-clockwise
_animatorAn Animator that will be manipulated if it has "Win" and "Lose" states
_wrongDirectionFailsIf True, then rotating in the opposite direction will instantly fail the QTE

◆ UpdateQTE()

void AC.PlayerQTE.UpdateQTE ( )

Updates the current QTE. This is called every frame by StateHandler.