TopDown Engine  v3.6
MoreMountains.TopDownEngine.Switch Class Reference

Switches can be used to trigger actions based on their current state (on or off). Useful to open doors, chests, portals, bridges... More...

Inheritance diagram for MoreMountains.TopDownEngine.Switch:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMMonoBehaviour

Public Types

enum  SwitchStates { SwitchStates.On, SwitchStates.Off }
 the possible states of the switch More...
 

Public Member Functions

virtual void TurnSwitchOn ()
 Turns the switch on More...
 
virtual void TurnSwitchOff ()
 Turns the switch off More...
 
virtual void ToggleSwitch ()
 Use this method to go from one state to the other More...
 

Public Attributes

Animator SwitchAnimator
 a SpriteReplace to represent the switch knob when it's on More...
 
SwitchStates InitialState = SwitchStates.Off
 the state the switch should start in More...
 
UnityEvent SwitchOn
 the methods to call when the switch is turned on More...
 
UnityEvent SwitchOff
 the methods to call when the switch is turned off More...
 
UnityEvent SwitchToggle
 the methods to call when the switch is toggled More...
 
MMFeedbacks SwitchOnFeedback
 a feedback to play when the switch is toggled on More...
 
MMFeedbacks SwitchOffFeedback
 a feedback to play when the switch is turned off More...
 
MMFeedbacks ToggleFeedback
 a feedback to play when the switch changes state More...
 
bool SwitchOnButton
 a test button to turn the switch on More...
 
bool SwitchOffButton
 a test button to turn the switch off More...
 
bool ToggleSwitchButton
 a test button to change the switch's state More...
 

Protected Member Functions

virtual void Start ()
 On init, we set our current switch state More...
 
virtual void Update ()
 On Update, we update our switch's animator More...
 

Properties

virtual SwitchStates CurrentSwitchState [get, set]
 the current state of the switch More...
 

Detailed Description

Switches can be used to trigger actions based on their current state (on or off). Useful to open doors, chests, portals, bridges...

Member Enumeration Documentation

◆ SwitchStates

the possible states of the switch

Enumerator
On 
Off 

Member Function Documentation

◆ Start()

virtual void MoreMountains.TopDownEngine.Switch.Start ( )
protectedvirtual

On init, we set our current switch state

◆ ToggleSwitch()

virtual void MoreMountains.TopDownEngine.Switch.ToggleSwitch ( )
virtual

Use this method to go from one state to the other

◆ TurnSwitchOff()

virtual void MoreMountains.TopDownEngine.Switch.TurnSwitchOff ( )
virtual

Turns the switch off

◆ TurnSwitchOn()

virtual void MoreMountains.TopDownEngine.Switch.TurnSwitchOn ( )
virtual

Turns the switch on

◆ Update()

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

On Update, we update our switch's animator

Member Data Documentation

◆ InitialState

SwitchStates MoreMountains.TopDownEngine.Switch.InitialState = SwitchStates.Off

the state the switch should start in

◆ SwitchAnimator

Animator MoreMountains.TopDownEngine.Switch.SwitchAnimator

a SpriteReplace to represent the switch knob when it's on

◆ SwitchOff

UnityEvent MoreMountains.TopDownEngine.Switch.SwitchOff

the methods to call when the switch is turned off

◆ SwitchOffButton

bool MoreMountains.TopDownEngine.Switch.SwitchOffButton

a test button to turn the switch off

◆ SwitchOffFeedback

MMFeedbacks MoreMountains.TopDownEngine.Switch.SwitchOffFeedback

a feedback to play when the switch is turned off

◆ SwitchOn

UnityEvent MoreMountains.TopDownEngine.Switch.SwitchOn

the methods to call when the switch is turned on

◆ SwitchOnButton

bool MoreMountains.TopDownEngine.Switch.SwitchOnButton

a test button to turn the switch on

◆ SwitchOnFeedback

MMFeedbacks MoreMountains.TopDownEngine.Switch.SwitchOnFeedback

a feedback to play when the switch is toggled on

◆ SwitchToggle

UnityEvent MoreMountains.TopDownEngine.Switch.SwitchToggle

the methods to call when the switch is toggled

◆ ToggleFeedback

MMFeedbacks MoreMountains.TopDownEngine.Switch.ToggleFeedback

a feedback to play when the switch changes state

◆ ToggleSwitchButton

bool MoreMountains.TopDownEngine.Switch.ToggleSwitchButton

a test button to change the switch's state

Property Documentation

◆ CurrentSwitchState

virtual SwitchStates MoreMountains.TopDownEngine.Switch.CurrentSwitchState
getset

the current state of the switch


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