Game Controller

namespace MAGES::GameController

namespace MAGES::GameController::Network

namespace MAGES::GameController

Summary

enum ControllerDOF

class MAGES::GameController::AudioController Controls the sounds used for each action in the application class MAGES::GameController::DeviceController This must be overriden by each controller class MAGES::GameController::MAGESControllerClass This class is the link between the device manager and network manager The Device manager needs to be overriden for each controller type

Members

enum ControllerDOF

TwoDOF
ThreeDOF
SixDOF

class MAGES::GameController::AudioController

class MAGES::GameController::AudioController
  : public MonoBehaviour

Controls the sounds used for each action in the application

Summary

{property} AudioController [Get] (#classovid_v_r_1_1_game_controller_1_1_audio_controller_1ae47ce91b9223f780ba2df0a15d6f1dcd)

public inline void ResetAudio() Resets the audio source properties public inline void PlayPerform() Play ‘perform’ sound public inline void PlayError() Play ‘error’ sound public inline void PlayCriticalError() Play ‘critical error’ sound public inline void PlayUndo() Play ‘undo’ sound protected inline  AudioController()

Members

{property} AudioController Get
public inline void ResetAudio()

Resets the audio source properties

public inline void PlayPerform()

Play ‘perform’ sound

public inline void PlayError()

Play ‘error’ sound

public inline void PlayCriticalError()

Play ‘critical error’ sound

public inline void PlayUndo()

Play ‘undo’ sound

protected inline  AudioController()

class MAGES::GameController::DeviceController

class MAGES::GameController::DeviceController
  : public MonoBehaviour

This must be overriden by each controller

Summary

public ControllerDOF DOF Current DeviceController degrees of freedom

public inline virtual Material GetThumpStickMaterial(MAGESControllerClass.MAGESHand _hand) Controller Material functions that returns the material of the “_hand” thumpstick/trackpad

public inline virtual void SetThumpSticMaterial(MAGESControllerClass.MAGESHand _hand,Material mat) Sets the material of the thumpstick or trackpad

public abstract void SetHandColor(Color _handColor,float _flashSpeed,MAGESControllerClass.MAGESHand _hand) Sets the Color of the desired hand

public abstract void ResetHandsColor() Resets the color of both hands and stops the flashing

public abstract void SetDefaultHandsColor(Color _color) Sets the default color for both hands

public abstract void SetControllerState(MAGESControllerClass.MAGESHand _hand,bool state) Sets the state of the controller (enable or disabled)

public abstract void SetLeftHandTransparency(float _alpha)

public abstract void SetRightHandTransparency(float _alpha)

public abstract void SetMenuButtonFlashing(MAGESControllerClass.MAGESHand _hand)

public abstract void StopMenuButtonFlashing(MAGESControllerClass.MAGESHand _hand)

public abstract void SetButtonFlashing(bool _enabled,MAGESControllerClass.MAGESHand_hand,paramsMAGESControllerClass.MAGESControllerButtons _buttons) Sets a flashing animation to the given buttons

public abstract void SetHandTransparency(float _alpha,MAGESControllerClass.MAGESHand _hand) Sets hand transparency

public abstract bool MovementEnabled(MAGESControllerClass.MAGESHand _hand)

public abstract bool IsMoving()

public abstract bool GetTrackPadPressed(MAGESControllerClass.MAGESHand _hand) Gets the trackpad/thumpstick current state

public abstract bool GetTriggerPressed(MAGESControllerClass.MAGESHand _hand) Gets the trigger current state

public abstract bool GetGripPressed(MAGESControllerClass.MAGESHand _hand) Gets the grip state

public inline virtual MAGESControllerClass.ControllerTypes GetControllerType() Gets the state of the controller

public inline virtual void SetControllerType(MAGESControllerClass.ControllerTypes _controllerTypes) Sets the controller state

public abstract float GetControllerGrabStrength(MAGESControllerClass.MAGESHand _hand) Function to get the controllers grab strength value.

public abstract string GetHandTag(GameObject child) Get a string representation of the hand tag

public abstract Transform GetHandTransform(GameObject child) Returns the Transform of the current controllers hand gameobject

public abstract void ControllerHapticPulse(MAGESControllerClass.MAGESHand _hand,float strength,float _freq,float _duration) Creates a haptic pulse on vive controller

public abstract bool GetIsGrabed(MAGESControllerClass.MAGESHand _hand) Get the state if the grip button is pressed

public abstract void SetBothControllersConnection(bool _bothContrConnected)

public abstract Vector2 GetThumpPosOnController(MAGESControllerClass.MAGESHand _hand) Returns the position of the thump

public abstract MAGESControllerClass.MAGESControllerButtons GetPressedButtons() Sees which buttons are pressed

Members

public ControllerDOF DOF

Current DeviceController degrees of freedom

public inline virtual Material GetThumpStickMaterial(MAGESControllerClass.MAGESHand _hand)

Controller Material functions that returns the material of the “_hand” thumpstick/trackpad

Parameters
  • hand

Returns

Returns the thumpstick/trackpad material

public inline virtual void SetThumpSticMaterial(MAGESControllerClass.MAGESHand _hand,Material mat)

Sets the material of the thumpstick or trackpad

Parameters
  • _hand Which hand

  • mat Material to set

public abstract void SetHandColor(Color _handColor,float _flashSpeed,MAGESControllerClass.MAGESHand _hand)

Sets the Color of the desired hand

Parameters
  • _hand

  • _handColor

  • _flashSpeed

public abstract void ResetHandsColor()

Resets the color of both hands and stops the flashing

public abstract void SetDefaultHandsColor(Color _color)

Sets the default color for both hands

Parameters
  • _color

public abstract void SetControllerState(MAGESControllerClass.MAGESHand _hand,bool state)

Sets the state of the controller (enable or disabled)

Parameters
  • _hand

  • state true -> enabled

public abstract void SetLeftHandTransparency(float _alpha)
public abstract void SetRightHandTransparency(float _alpha)
public abstract void SetButtonFlashing(bool _enabled,MAGESControllerClass.MAGESHand_hand,paramsMAGESControllerClass.MAGESControllerButtons _buttons)

Sets a flashing animation to the given buttons

Parameters
  • _enabled Enable OR disable flashing animation

  • _hand The hand to use

  • _buttons Array or list of buttons to use

public abstract void SetHandTransparency(float _alpha,MAGESControllerClass.MAGESHand _hand)

Sets hand transparency

Parameters
  • _alpha Transparency Value

  • _hand Hand: left OR right

public abstract bool IsMoving()
public abstract bool GetTrackPadPressed(MAGESControllerClass.MAGESHand _hand)

Gets the trackpad/thumpstick current state

Parameters
  • _hand

Returns

Returns true if the thumpstick/trackpad is pressed

public abstract bool GetTriggerPressed(MAGESControllerClass.MAGESHand _hand)

Gets the trigger current state

Parameters
  • _hand

Returns

Returns trus if trigger is pressed

public abstract bool GetGripPressed(MAGESControllerClass.MAGESHand _hand)

Gets the grip state

Parameters
  • _hand

Returns

Returns true if grip buttons is pressed

public inline virtual MAGESControllerClass.ControllerTypes GetControllerType()

Gets the state of the controller

Returns

Returns true if the controller is enabled, false otherwise

public inline virtual void SetControllerType(MAGESControllerClass.ControllerTypes _controllerTypes)

Sets the controller state

Parameters
  • _controllerTypes

public abstract float GetControllerGrabStrength(MAGESControllerClass.MAGESHand _hand)

Function to get the controllers grab strength value.

Returns -2.0f if no controller is specified

Parameters
  • hand Can be either “left” or “right”

Returns
public abstract string GetHandTag(GameObject child)

Get a string representation of the hand tag

Parameters
  • child The child gameobject, usually the colliding object

Returns

Returns the Tag of the current controllers hand gameobject

Returns null if no controller is specified

public abstract Transform GetHandTransform(GameObject child)

Returns the Transform of the current controllers hand gameobject

Parameters
  • child The child collider of the hand

Returns

Returns the transform of the current hand gameobject

Returns null if no controller is specified

public abstract void ControllerHapticPulse(MAGESControllerClass.MAGESHand _hand,float strength,float _freq,float _duration)

Creates a haptic pulse on vive controller

Parameters
  • hand Left OR right controller

  • strength The pulse strength : [Range 0 -> 1]

public abstract bool GetIsGrabed(MAGESControllerClass.MAGESHand _hand)

Get the state if the grip button is pressed

Parameters
  • hand Hand to look if pressed

Returns

Returns true if the grip button is pressed

public abstract void SetBothControllersConnection(bool _bothContrConnected)
public abstract Vector2 GetThumpPosOnController(MAGESControllerClass.MAGESHand _hand)

Returns the position of the thump

Parameters
  • hand The hand that grabs an object in the scene

Returns

Returns an cartesian representation of the thump on the controller

public abstract MAGESControllerClass.MAGESControllerButtons GetPressedButtons()

Sees which buttons are pressed

Returns

Returns a list of the presseed buttons

class MAGES::GameController::MAGESControllerClass

class MAGES::GameController::MAGESControllerClass
  : public MonoBehaviour

This class is the link between the device manager and network manager The Device manager needs to be overriden for each controller type

Summary

{property} bool IsInNetwork

{property} ControllerDOF DOF Controller’s degrees of freedom, if DeviceController is null will find the first available DeviceController

{property} MAGESControllerClass Get Singleton Instance of MAGESControllerClass. public ControllerTypes controllerType

public bool isServer

public bool isClient

public GameObject rightController

public GameObject rightHand

public inline virtual GameObject AttachToolRight()

public inline virtual GameObject AttachToolLeft()

public inline virtual GameObject AttachTool(MAGESHand _hand)

public inline virtual ControllerTypes GetControllerType() User accessible function to get the current controller type

public inline virtual void SetControllerType(ControllerTypes _controllerTypes)

public inline void SetIsGrabed(bool value)

public inline float GetControllerGrabStrength(MAGESHand _hand) Function to get the controllers grab strength value.

public inline string GetHandTag(GameObject child) Returns the Tag of the current controllers hand gameobject

public inline void ControllerHapticPulse(MAGESHand _hand,float strength) Creates a haptic pulse on the controller

public inline bool GetIsGrabed(MAGESHand _hand) Returns true if the grip button is pressed

public inline void SetBothControllersConnection(bool _bothContrConnected)

public inline bool GetTriggerPressed(MAGESHand _hand) Get the status of trigger button

public inline MAGESControllerButtons GetPressedButtons() Sees which buttons are pressed

public inline bool GetIsSpectator()

protected inline  MAGESControllerClass() MAGESControllerClass protected constructor

enum ControllerTypes

enum MAGESHand

enum MAGESControllerButtons

Members

{property} bool IsInNetwork
{property} ControllerDOF DOF

Controller’s degrees of freedom, if DeviceController is null will find the first available DeviceController

{property} MAGESControllerClass Get

Singleton Instance of MAGESControllerClass.


Returns

Returns the main controller.

public bool isServer
public bool isClient
public GameObject rightController
public GameObject rightHand
public inline virtual GameObject AttachToolRight()
public inline virtual GameObject AttachToolLeft()
public inline virtual GameObject AttachTool(MAGESHand _hand)
public inline virtual ControllerTypes GetControllerType()

User accessible function to get the current controller type

Returns

Returns the type of current controller (HTC-Vice/Oculus Rift)

public inline virtual void SetControllerType(ControllerTypes _controllerTypes)
public inline void SetIsGrabed(bool value)
public inline float GetControllerGrabStrength(MAGESHand _hand)

Function to get the controllers grab strength value.

Returns -2.0f if no controller is specified

Parameters
  • hand Can be either left or right

Returns
public inline string GetHandTag(GameObject child)

Returns the Tag of the current controllers hand gameobject

Returns null if no controller is specified

Parameters
  • child The child gameobject, usually the colliding object

Returns
public inline void ControllerHapticPulse(MAGESHand _hand,float strength)

Creats a haptic pulse on the controller

Parameters
  • hand Left or right controller

  • strength The pulse strength : [Range 0 -> 1]

public inline bool GetIsGrabed(MAGESHand _hand)

Returns true if the grip button is pressed

Parameters
  • hand Hand to look if pressed

Returns
public inline void SetBothControllersConnection(bool _bothContrConnected)
public inline bool GetTriggerPressed(MAGESHand _hand)

Get the status of trigger button

Parameters
  • _hand In which hand

Returns

Returns if trigger is pressed

public inline MAGESControllerButtons GetPressedButtons()

Sees which buttons are pressed

Returns

Returns a list of the presseed buttons

public inline bool GetIsSpectator()
protected inline  MAGESControllerClass()

MAGESControllerClass protected constructor

Initializes the Singleton Instance!!!

enum ControllerTypes

HTCViveController
OculusTouchController
WindowsMixedRealityController
NoController

enum MAGESHand

left
right

enum MAGESControllerButtons

TriggerButton
GripButton
MenuButton
A
B
X
Y
ThumbStick

namespace MAGES::GameController::Network

Summary

class MAGES::GameController::Network::MAGESNetworkmanager Base class for network managment Some functions need to be overriden to add application specific functionalities

class MAGES::GameController::Network::MAGESNetworkmanager

Base class for network managment Some functions need to be overriden to add application specific functionalities

Summary

public Transform spawnPosition

public int curPlayer

public inline virtual void OnStartServer() Called when starting a network session as server

public inline virtual void OnStartClient() Called when starting a network session as client

public inline bool GetIsInNetwork()

public inline bool GetIsServer() Gets the status of the current application instance

public inline bool GetIsClient() Gets the status of the current application instance

public inline void SetIsServer(bool value) Sets the status of the current application instance

public inline void SetIsClient(bool value) Sets the status of the current application instance

public inline bool GetIsSpectator()

public inline void SetIsSpectator(bool _isSpectator)

Members

public Transform spawnPosition
public int curPlayer
public inline virtual void OnStartServer()

Called when starting a network session as server

public inline virtual void OnStartClient()

Called when starting a network session as client

Parameters
  • client

public inline bool GetIsInNetwork()
Returns

True if the local machine is in a network session.

public inline bool GetIsServer()

Gets the status of the current application instance

Returns

Returns true if the application is the server

public inline bool GetIsClient()

Gets the status of the current application instance

Returns

Returns true if the application is client

public inline void SetIsServer(bool value)

Sets the status of the current application instance

public inline void SetIsClient(bool value)

Sets the status of the current application instance

public inline bool GetIsSpectator()
public inline void SetIsSpectator(bool _isSpectator)