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

Add this class to an empty component in your scene, and it'll allow you to swap characters in your scene when pressing the SwapButton (P, by default) Each character in your scene will need to have a CharacterSwap class on it, and the corresponding PlayerID. You can see an example of such a setup in the MinimalCharacterSwap demo scene More...

Inheritance diagram for MoreMountains.TopDownEngine.CharacterSwapManager:
MoreMountains.Tools.MMSingleton< CharacterSwapManager > MoreMountains.Tools.MMEventListener< TopDownEngineEvent >

Public Member Functions

virtual void UpdateList ()
 Grabs all CharacterSwap equipped characters in the scene and stores them in a list, sorted by Order More...
 
virtual void SwapCharacter ()
 Changes the current character to the next one in line More...
 
virtual int GetCurrentIndex ()
 Finds which character is currently active and considered the current one More...
 
virtual void OnMMEvent (TopDownEngineEvent engineEvent)
 On Level Start, we initialize our list More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< TopDownEngineEvent >
void OnMMEvent (T eventType)
 

Public Attributes

string SwapButtonName = "Player1_SwapCharacter"
 the name of the axis to use to catch input and trigger a swap on press More...
 
string PlayerID = "Player1"
 the PlayerID set on the Characters you want to swap between More...
 

Protected Member Functions

virtual void Update ()
 On Update, we watch for input More...
 
virtual void HandleInput ()
 If the user presses the Swap button, we swap characters More...
 
virtual void OnEnable ()
 On enable we start listening for events More...
 
virtual void OnDisable ()
 On disable we stop listening for events More...
 
- Protected Member Functions inherited from MoreMountains.Tools.MMSingleton< CharacterSwapManager >
virtual void Awake ()
 On awake, we initialize our instance. Make sure to call base.Awake() in override if you need awake. More...
 
virtual void InitializeSingleton ()
 Initializes the singleton. More...
 

Static Protected Member Functions

static void InitializeStatics ()
 Statics initialization to support enter play modes More...
 

Protected Attributes

CharacterSwap[] _characterSwapArray
 
MMCircularList< CharacterSwap_characterSwapList
 
TopDownEngineEvent _swapEvent = new TopDownEngineEvent(TopDownEngineEventTypes.CharacterSwap, null)
 

Additional Inherited Members

- Static Public Member Functions inherited from MoreMountains.Tools.MMSingleton< CharacterSwapManager >
static T TryGetInstance ()
 
- Static Public Attributes inherited from MoreMountains.Tools.MMSingleton< CharacterSwapManager >
static bool HasInstance
 
static T Current
 
- Static Protected Attributes inherited from MoreMountains.Tools.MMSingleton< CharacterSwapManager >
static T _instance
 
- Properties inherited from MoreMountains.Tools.MMSingleton< CharacterSwapManager >
static T Instance [get]
 Singleton design pattern More...
 

Detailed Description

Add this class to an empty component in your scene, and it'll allow you to swap characters in your scene when pressing the SwapButton (P, by default) Each character in your scene will need to have a CharacterSwap class on it, and the corresponding PlayerID. You can see an example of such a setup in the MinimalCharacterSwap demo scene

Member Function Documentation

◆ GetCurrentIndex()

virtual int MoreMountains.TopDownEngine.CharacterSwapManager.GetCurrentIndex ( )
virtual

Finds which character is currently active and considered the current one

Returns

◆ HandleInput()

virtual void MoreMountains.TopDownEngine.CharacterSwapManager.HandleInput ( )
protectedvirtual

If the user presses the Swap button, we swap characters

◆ InitializeStatics()

static void MoreMountains.TopDownEngine.CharacterSwapManager.InitializeStatics ( )
staticprotected

Statics initialization to support enter play modes

◆ OnDisable()

virtual void MoreMountains.TopDownEngine.CharacterSwapManager.OnDisable ( )
protectedvirtual

On disable we stop listening for events

◆ OnEnable()

virtual void MoreMountains.TopDownEngine.CharacterSwapManager.OnEnable ( )
protectedvirtual

On enable we start listening for events

◆ OnMMEvent()

virtual void MoreMountains.TopDownEngine.CharacterSwapManager.OnMMEvent ( TopDownEngineEvent  engineEvent)
virtual

On Level Start, we initialize our list

Parameters
eventType

◆ SwapCharacter()

virtual void MoreMountains.TopDownEngine.CharacterSwapManager.SwapCharacter ( )
virtual

Changes the current character to the next one in line

◆ Update()

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

On Update, we watch for input

◆ UpdateList()

virtual void MoreMountains.TopDownEngine.CharacterSwapManager.UpdateList ( )
virtual

Grabs all CharacterSwap equipped characters in the scene and stores them in a list, sorted by Order

Member Data Documentation

◆ _characterSwapArray

CharacterSwap [] MoreMountains.TopDownEngine.CharacterSwapManager._characterSwapArray
protected

◆ _characterSwapList

MMCircularList<CharacterSwap> MoreMountains.TopDownEngine.CharacterSwapManager._characterSwapList
protected

◆ _swapEvent

TopDownEngineEvent MoreMountains.TopDownEngine.CharacterSwapManager._swapEvent = new TopDownEngineEvent(TopDownEngineEventTypes.CharacterSwap, null)
protected

◆ PlayerID

string MoreMountains.TopDownEngine.CharacterSwapManager.PlayerID = "Player1"

the PlayerID set on the Characters you want to swap between

◆ SwapButtonName

string MoreMountains.TopDownEngine.CharacterSwapManager.SwapButtonName = "Player1_SwapCharacter"

the name of the axis to use to catch input and trigger a swap on press


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