TopDown Engine
v3.6
|
An abstract class, meant to be extended for 2D and 3D specifics, handling the basics of auto aim. Extended components should be placed on a weapon with an aim component More...
Public Member Functions | |
virtual bool | CanAcquireNewTargets () |
Public Attributes | |
LayerMask | TargetsMask |
the layermask on which to look for aim targets More... | |
LayerMask | ObstacleMask = LayerManager.ObstaclesLayerMask |
the layermask on which to look for obstacles More... | |
float | ScanRadius = 15f |
the radius (in units) around the character within which to search for targets More... | |
Vector2 | LineOfFireBoxcastSize = new Vector2(0.1f, 0.1f) |
the size of the boxcast that will be performed to verify line of fire More... | |
float | DurationBetweenScans = 1f |
the duration (in seconds) between 2 scans for targets More... | |
Vector3 | DetectionOriginOffset = Vector3.zero |
an offset to apply to the weapon's position for scan More... | |
bool | OnlyAcquireTargetsIfOwnerIsIdle = false |
if this is true, auto aim scan will only acquire new targets if the owner is in the idle state More... | |
WeaponAim.RotationModes | RotationMode |
the rotation mode to apply when a target is found More... | |
bool | ApplyAutoAimAsLastDirection = true |
if this is true, the auto aim direction will also be passed as the last non null direction, so the weapon will keep aiming in that direction should the target be lost More... | |
bool | MoveCameraTarget = true |
whether or not this component should take control of the camera target when a camera is found More... | |
float | CameraTargetDistance = 0.5f |
the normalized distance (between 0 and 1) at which the camera target should be, on a line going from the weapon owner (0) to the auto aim target (1) More... | |
float | CameraTargetMaxDistance = 10f |
the maximum distance from the weapon owner at which the camera target can be More... | |
float | CameraTargetSpeed = 5f |
the speed at which to move the camera target More... | |
bool | MoveCameraToCharacterIfNoTarget = false |
if this is true, the camera target will move back to the character if no target is found More... | |
AimMarker | AimMarkerPrefab |
An AimMarker prefab to use to show where this auto aim weapon is aiming. More... | |
bool | DestroyAimMarkerOnWeaponDestroy = true |
if this is true, the aim marker will be removed when the weapon gets destroyed More... | |
MMFeedbacks | FirstTargetFoundFeedback |
A feedback to play when a target is found and we didn't have one already. More... | |
MMFeedbacks | NewTargetFoundFeedback |
a feedback to play when we already had a target and just found a new one More... | |
MMFeedbacks | NoMoreTargetsFeedback |
a feedback to play when no more targets are found, and we just lost our last target More... | |
Transform | Target |
the current target of the auto aim module More... | |
bool | DrawDebugRadius = true |
whether or not to draw a debug sphere around the weapon to show its aim radius More... | |
Protected Member Functions | |
virtual void | Start () |
On Awake we initialize our component More... | |
virtual void | Initialization () |
On init we grab our WeaponAim More... | |
virtual void | Update () |
On Update, we setup our ray origin, scan periodically and set aim if needed More... | |
abstract void | DetermineRaycastOrigin () |
A method used to compute the origin of the detection casts More... | |
abstract bool | ScanForTargets () |
This method should define how the scan for targets is performed More... | |
abstract void | SetAim () |
Sends aim coordinates to the weapon aim component More... | |
virtual void | HandleTargetChange () |
Checks for target changes and triggers the appropriate methods if needed More... | |
virtual void | NoMoreTargets () |
When no more targets are found, and we just lost one, we play a dedicated feedback More... | |
virtual void | FirstTargetFound () |
When a new target is found and we didn't have one already, we play a dedicated feedback More... | |
virtual void | NewTargetFound () |
When a new target is found, and we previously had another, we play a dedicated feedback More... | |
virtual void | HandleMoveCameraTarget () |
Moves the camera target if needed More... | |
virtual void | ScanIfNeeded () |
Performs a periodic scan More... | |
virtual void | HandleTarget () |
Sets aim if needed, otherwise reverts to the previous aim control mode More... | |
virtual void | OnDrawGizmos () |
Draws a sphere around the weapon to show its auto aim radius More... | |
virtual void | OnDisable () |
On Disable, we hide our aim marker if needed More... | |
void | OnDestroy () |
Protected Attributes | |
float | _lastScanTimestamp = 0f |
WeaponAim | _weaponAim |
WeaponAim.AimControls | _originalAimControl |
WeaponAim.RotationModes | _originalRotationMode |
Vector3 | _raycastOrigin |
Weapon | _weapon |
bool | _originalMoveCameraTarget |
Transform | _targetLastFrame |
AimMarker | _aimMarker |
Vector3 | _newCamTargetPosition |
Moves the camera target towards the auto aim target if needed More... | |
Vector3 | _newCamTargetDirection |
bool | _isOwnerNull |
An abstract class, meant to be extended for 2D and 3D specifics, handling the basics of auto aim. Extended components should be placed on a weapon with an aim component
|
virtual |
|
protectedpure virtual |
A method used to compute the origin of the detection casts
Implemented in MoreMountains.TopDownEngine.WeaponAutoAim3D, and MoreMountains.TopDownEngine.WeaponAutoAim2D.
|
protectedvirtual |
When a new target is found and we didn't have one already, we play a dedicated feedback
|
protectedvirtual |
Moves the camera target if needed
|
protectedvirtual |
Sets aim if needed, otherwise reverts to the previous aim control mode
|
protectedvirtual |
Checks for target changes and triggers the appropriate methods if needed
|
protectedvirtual |
On init we grab our WeaponAim
Reimplemented in MoreMountains.TopDownEngine.WeaponAutoAim3D, and MoreMountains.TopDownEngine.WeaponAutoAim2D.
|
protectedvirtual |
When a new target is found, and we previously had another, we play a dedicated feedback
|
protectedvirtual |
When no more targets are found, and we just lost one, we play a dedicated feedback
|
protected |
|
protectedvirtual |
On Disable, we hide our aim marker if needed
|
protectedvirtual |
Draws a sphere around the weapon to show its auto aim radius
Reimplemented in MoreMountains.TopDownEngine.WeaponAutoAim3D.
|
protectedpure virtual |
This method should define how the scan for targets is performed
Implemented in MoreMountains.TopDownEngine.WeaponAutoAim3D, and MoreMountains.TopDownEngine.WeaponAutoAim2D.
|
protectedvirtual |
Performs a periodic scan
|
protectedpure virtual |
Sends aim coordinates to the weapon aim component
Implemented in MoreMountains.TopDownEngine.WeaponAutoAim3D, and MoreMountains.TopDownEngine.WeaponAutoAim2D.
|
protectedvirtual |
On Awake we initialize our component
|
protectedvirtual |
On Update, we setup our ray origin, scan periodically and set aim if needed
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Moves the camera target towards the auto aim target if needed
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
AimMarker MoreMountains.TopDownEngine.WeaponAutoAim.AimMarkerPrefab |
An AimMarker prefab to use to show where this auto aim weapon is aiming.
bool MoreMountains.TopDownEngine.WeaponAutoAim.ApplyAutoAimAsLastDirection = true |
if this is true, the auto aim direction will also be passed as the last non null direction, so the weapon will keep aiming in that direction should the target be lost
float MoreMountains.TopDownEngine.WeaponAutoAim.CameraTargetDistance = 0.5f |
the normalized distance (between 0 and 1) at which the camera target should be, on a line going from the weapon owner (0) to the auto aim target (1)
float MoreMountains.TopDownEngine.WeaponAutoAim.CameraTargetMaxDistance = 10f |
the maximum distance from the weapon owner at which the camera target can be
float MoreMountains.TopDownEngine.WeaponAutoAim.CameraTargetSpeed = 5f |
the speed at which to move the camera target
bool MoreMountains.TopDownEngine.WeaponAutoAim.DestroyAimMarkerOnWeaponDestroy = true |
if this is true, the aim marker will be removed when the weapon gets destroyed
Vector3 MoreMountains.TopDownEngine.WeaponAutoAim.DetectionOriginOffset = Vector3.zero |
an offset to apply to the weapon's position for scan
bool MoreMountains.TopDownEngine.WeaponAutoAim.DrawDebugRadius = true |
whether or not to draw a debug sphere around the weapon to show its aim radius
float MoreMountains.TopDownEngine.WeaponAutoAim.DurationBetweenScans = 1f |
the duration (in seconds) between 2 scans for targets
MMFeedbacks MoreMountains.TopDownEngine.WeaponAutoAim.FirstTargetFoundFeedback |
A feedback to play when a target is found and we didn't have one already.
Vector2 MoreMountains.TopDownEngine.WeaponAutoAim.LineOfFireBoxcastSize = new Vector2(0.1f, 0.1f) |
the size of the boxcast that will be performed to verify line of fire
bool MoreMountains.TopDownEngine.WeaponAutoAim.MoveCameraTarget = true |
whether or not this component should take control of the camera target when a camera is found
bool MoreMountains.TopDownEngine.WeaponAutoAim.MoveCameraToCharacterIfNoTarget = false |
if this is true, the camera target will move back to the character if no target is found
MMFeedbacks MoreMountains.TopDownEngine.WeaponAutoAim.NewTargetFoundFeedback |
a feedback to play when we already had a target and just found a new one
MMFeedbacks MoreMountains.TopDownEngine.WeaponAutoAim.NoMoreTargetsFeedback |
a feedback to play when no more targets are found, and we just lost our last target
LayerMask MoreMountains.TopDownEngine.WeaponAutoAim.ObstacleMask = LayerManager.ObstaclesLayerMask |
the layermask on which to look for obstacles
bool MoreMountains.TopDownEngine.WeaponAutoAim.OnlyAcquireTargetsIfOwnerIsIdle = false |
if this is true, auto aim scan will only acquire new targets if the owner is in the idle state
WeaponAim.RotationModes MoreMountains.TopDownEngine.WeaponAutoAim.RotationMode |
the rotation mode to apply when a target is found
float MoreMountains.TopDownEngine.WeaponAutoAim.ScanRadius = 15f |
the radius (in units) around the character within which to search for targets
Transform MoreMountains.TopDownEngine.WeaponAutoAim.Target |
the current target of the auto aim module
LayerMask MoreMountains.TopDownEngine.WeaponAutoAim.TargetsMask |
the layermask on which to look for aim targets