TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.TopDownEngine.WeaponAimMouseOverride Class Reference

Add this component to a WeaponAim, and it'll automatically handle switching its weapon aim control mode to mouse if mouse becomes active. If you then touch any of the gamepad axis again, it'll switch back aim control to it. The WeaponAim control mode needs to be initially set to a gamepad control mode. More...

Inheritance diagram for MoreMountains.TopDownEngine.WeaponAimMouseOverride:

Public Member Functions

virtual void GetInitialAimControl ()
 Sets the current aim control mode as the initial one, that the component will switch back to when going back from mouse mode.
virtual void SwitchToMouse ()
 Changes aim control mode to mouse.
virtual void SwitchToInitialControlMode ()
 Changes aim control mouse to the initial mode.

Public Attributes

bool CheckMouse = true
 if this is true, mouse position will be evaluated, and if it differs from the one last frame, we'll switch to mouse control mode
bool CheckPrimaryAxis = true
 if this is true, the primary axis will be evaluated, and if it differs from the one last frame, we'll switch back to the initial control mode
bool CheckSecondaryAxis = true
 if this is true, the secondary axis will be evaluated, and if it differs from the one last frame, we'll switch back to the initial control mode

Protected Member Functions

virtual void Awake ()
 On Awake we store our WeaponAim component and grab our initial aim control mode.
virtual void Update ()
 On update, checks mouse and axis, and stores last frame's data.
virtual void StoreLastFrameData ()
 We store our current input data to be able to compare against it next frame.
virtual void CheckMouseInput ()
 Checks if mouse input has changed, switches to mouse control if that's the case.
virtual void CheckAxisInput ()
 Checks if axis input has changed, switches back to initial control mode if that's the case.

Protected Attributes

WeaponAim _weaponAim
Vector2 _primaryAxisInput
Vector2 _primaryAxisInputLastFrame
Vector2 _secondaryAxisInput
Vector2 _secondaryAxisInputLastFrame
Vector2 _mouseInput
Vector2 _mouseInputLastFrame
WeaponAim.AimControls _initialAimControl

Detailed Description

Add this component to a WeaponAim, and it'll automatically handle switching its weapon aim control mode to mouse if mouse becomes active. If you then touch any of the gamepad axis again, it'll switch back aim control to it. The WeaponAim control mode needs to be initially set to a gamepad control mode.

Member Function Documentation

◆ Awake()

virtual void MoreMountains.TopDownEngine.WeaponAimMouseOverride.Awake ( )
protectedvirtual

On Awake we store our WeaponAim component and grab our initial aim control mode.

◆ CheckAxisInput()

virtual void MoreMountains.TopDownEngine.WeaponAimMouseOverride.CheckAxisInput ( )
protectedvirtual

Checks if axis input has changed, switches back to initial control mode if that's the case.

◆ CheckMouseInput()

virtual void MoreMountains.TopDownEngine.WeaponAimMouseOverride.CheckMouseInput ( )
protectedvirtual

Checks if mouse input has changed, switches to mouse control if that's the case.

◆ GetInitialAimControl()

virtual void MoreMountains.TopDownEngine.WeaponAimMouseOverride.GetInitialAimControl ( )
virtual

Sets the current aim control mode as the initial one, that the component will switch back to when going back from mouse mode.

◆ StoreLastFrameData()

virtual void MoreMountains.TopDownEngine.WeaponAimMouseOverride.StoreLastFrameData ( )
protectedvirtual

We store our current input data to be able to compare against it next frame.

◆ SwitchToInitialControlMode()

virtual void MoreMountains.TopDownEngine.WeaponAimMouseOverride.SwitchToInitialControlMode ( )
virtual

Changes aim control mouse to the initial mode.

◆ SwitchToMouse()

virtual void MoreMountains.TopDownEngine.WeaponAimMouseOverride.SwitchToMouse ( )
virtual

Changes aim control mode to mouse.

◆ Update()

virtual void MoreMountains.TopDownEngine.WeaponAimMouseOverride.Update ( )
protectedvirtual

On update, checks mouse and axis, and stores last frame's data.

Member Data Documentation

◆ _initialAimControl

WeaponAim.AimControls MoreMountains.TopDownEngine.WeaponAimMouseOverride._initialAimControl
protected

◆ _mouseInput

Vector2 MoreMountains.TopDownEngine.WeaponAimMouseOverride._mouseInput
protected

◆ _mouseInputLastFrame

Vector2 MoreMountains.TopDownEngine.WeaponAimMouseOverride._mouseInputLastFrame
protected

◆ _primaryAxisInput

Vector2 MoreMountains.TopDownEngine.WeaponAimMouseOverride._primaryAxisInput
protected

◆ _primaryAxisInputLastFrame

Vector2 MoreMountains.TopDownEngine.WeaponAimMouseOverride._primaryAxisInputLastFrame
protected

◆ _secondaryAxisInput

Vector2 MoreMountains.TopDownEngine.WeaponAimMouseOverride._secondaryAxisInput
protected

◆ _secondaryAxisInputLastFrame

Vector2 MoreMountains.TopDownEngine.WeaponAimMouseOverride._secondaryAxisInputLastFrame
protected

◆ _weaponAim

WeaponAim MoreMountains.TopDownEngine.WeaponAimMouseOverride._weaponAim
protected

◆ CheckMouse

bool MoreMountains.TopDownEngine.WeaponAimMouseOverride.CheckMouse = true

if this is true, mouse position will be evaluated, and if it differs from the one last frame, we'll switch to mouse control mode

◆ CheckPrimaryAxis

bool MoreMountains.TopDownEngine.WeaponAimMouseOverride.CheckPrimaryAxis = true

if this is true, the primary axis will be evaluated, and if it differs from the one last frame, we'll switch back to the initial control mode

◆ CheckSecondaryAxis

bool MoreMountains.TopDownEngine.WeaponAimMouseOverride.CheckSecondaryAxis = true

if this is true, the secondary axis will be evaluated, and if it differs from the one last frame, we'll switch back to the initial control mode


The documentation for this class was generated from the following file: