TopDown Engine v4.5
Loading...
Searching...
No Matches
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< T > MoreMountains.Tools.MMEventListener< T > MoreMountains.Tools.MMEventListenerBase

Public Member Functions

virtual void UpdateList ()
 Grabs all CharacterSwap equipped characters in the scene and stores them in a list, sorted by Order.
virtual void SwapCharacter ()
 Changes the current character to the next one in line.
virtual int GetCurrentIndex ()
 Finds which character is currently active and considered the current one.
virtual void OnMMEvent (TopDownEngineEvent engineEvent)
 On Level Start, we initialize our list.
Public Member Functions inherited from MoreMountains.Tools.MMEventListener< T >
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
string PlayerID = "Player1"
 the PlayerID set on the Characters you want to swap between

Protected Member Functions

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

Static Protected Member Functions

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

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< T >
static T TryGetInstance ()
Static Protected Attributes inherited from MoreMountains.Tools.MMSingleton< T >
static T _instance
Properties inherited from MoreMountains.Tools.MMSingleton< T >
static bool HasInstance [get]
static T Current [get]
static T Instance [get]
 Singleton design pattern.

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()

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: