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

Public Member Functions

void UpdatePlayerMovement ()
 
Vector3 ClickPoint (Vector2 screenPosition, bool onNavMesh=false)
 Gets the point in world space that a point in screen space is above. More...
 

Public Attributes

LayerMask pointClickLayerMask = -1
 

Protected Member Functions

void UpdateMoveStraightToCursorTime ()
 
void MoveStraightToCursor ()
 
Vector3 GetStraightToCursorClickPoint ()
 
void DragPlayer (bool doRotation, Vector2 moveKeys)
 
void DragPlayerTouch (Vector2 moveKeys)
 
void DirectControlPlayer (bool isFirstPerson, Vector2 moveKeys)
 
void DirectControlPlayerPath (Vector2 moveKeys)
 
void PointControlPlayer ()
 
bool ProcessHit (Vector3 hitPoint, GameObject hitObject, bool run)
 
void PointMovePlayer (Vector3[] pointArray, bool run)
 
bool SearchForNavMesh2D (Vector2 mousePosition, Vector2 direction, bool run)
 
bool RaycastNavMesh (Vector3 mousePosition, bool run)
 
void ShowClick (Vector3 clickPoint)
 
void FirstPersonControlPlayer ()
 
void DragPlayerLook ()
 
virtual bool UnityUIBlocksClick ()
 

Protected Attributes

float moveStraightToCursorUpdateTime
 
GameObject clickPrefabInstance
 
float destinationThresholdOverride = -1f
 
bool doubleClickRan
 
float moveStraightToCursorHoldTime
 
bool movingFromHold
 

Properties

GameObject ClickPrefabInstance [get]
 
float DestinationThreshold [get, set]
 

Detailed Description

This script analyses the variables in PlayerInput, and moves the character based on the control style, defined in the SettingsManager. It should be placed on the GameEngine prefab.

Member Function Documentation

◆ ClickPoint()

Vector3 AC.PlayerMovement.ClickPoint ( Vector2  screenPosition,
bool  onNavMesh = false 
)

Gets the point in world space that a point in screen space is above.

Parameters
screenPositionThe position in screen space
Parameters
onNavMeshIf True, then only objects placed on the NavMesh layer will be detected.
Returns
The point in world space that a point in screen space is above

◆ UpdatePlayerMovement()

void AC.PlayerMovement.UpdatePlayerMovement ( )

Updates the movement handler. This is called every frame by StateHandler.

Member Data Documentation

◆ pointClickLayerMask

LayerMask AC.PlayerMovement.pointClickLayerMask = -1

The LayerMask used when raycasting for point-and-click movement

Property Documentation

◆ DestinationThreshold

float AC.PlayerMovement.DestinationThreshold
getset

The minimum distance between the Player and their destination considered to be "close enough". This is normally set by the Settings Manager's "Destination accuracy" slider, but can be overridden here if set to a non-negative value.