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

Add this component to an empty object in your scene, and when you'll press the SwitchCharacter button (P by default, change that in Unity's InputManager settings), your main character will be replaced by one of the prefabs in the list set on this component. You can decide the order (sequential or random), and have as many as you want. Note that this will change the whole prefab, not just the visuals. If you're just after a visual change, look at the CharacterSwitchModel ability. If you want to swap characters between a bunch of characters within a scene, look at the CharacterSwap ability and CharacterSwapManager More...

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

Public Types

enum  NextCharacterChoices { NextCharacterChoices.Sequential, NextCharacterChoices.Random }
 the possible orders the next character can be selected from More...
 

Public Attributes

Character[] CharacterPrefabs
 the list of possible characters prefabs to switch to More...
 
NextCharacterChoices NextCharacterChoice = NextCharacterChoices.Sequential
 the order in which to pick the next character More...
 
int CurrentIndex = 0
 the initial (and at runtime, current) index of the character prefab More...
 
bool CommonHealth
 if this is true, current health value will be passed from character to character More...
 
ParticleSystem CharacterSwitchVFX
 a particle system to play when a character gets changed More...
 

Protected Member Functions

virtual void Start ()
 On Awake we grab our input manager and instantiate our characters and VFX More...
 
virtual void InstantiateCharacters ()
 Instantiates and disables all characters in our list More...
 
virtual void InstantiateVFX ()
 Instantiates and disables the particle system if needed More...
 
virtual void Update ()
 On Update we watch for our input More...
 
virtual void SwitchCharacter ()
 Switches to the next character in the list More...
 

Protected Attributes

Character[] _instantiatedCharacters
 
ParticleSystem _instantiatedVFX
 
InputManager _inputManager
 
TopDownEngineEvent _switchEvent = new TopDownEngineEvent(TopDownEngineEventTypes.CharacterSwitch, null)
 

Detailed Description

Add this component to an empty object in your scene, and when you'll press the SwitchCharacter button (P by default, change that in Unity's InputManager settings), your main character will be replaced by one of the prefabs in the list set on this component. You can decide the order (sequential or random), and have as many as you want. Note that this will change the whole prefab, not just the visuals. If you're just after a visual change, look at the CharacterSwitchModel ability. If you want to swap characters between a bunch of characters within a scene, look at the CharacterSwap ability and CharacterSwapManager

Member Enumeration Documentation

◆ NextCharacterChoices

the possible orders the next character can be selected from

Enumerator
Sequential 
Random 

Member Function Documentation

◆ InstantiateCharacters()

virtual void MoreMountains.TopDownEngine.CharacterSwitchManager.InstantiateCharacters ( )
protectedvirtual

Instantiates and disables all characters in our list

◆ InstantiateVFX()

virtual void MoreMountains.TopDownEngine.CharacterSwitchManager.InstantiateVFX ( )
protectedvirtual

Instantiates and disables the particle system if needed

◆ Start()

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

On Awake we grab our input manager and instantiate our characters and VFX

◆ SwitchCharacter()

virtual void MoreMountains.TopDownEngine.CharacterSwitchManager.SwitchCharacter ( )
protectedvirtual

Switches to the next character in the list

◆ Update()

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

On Update we watch for our input

Member Data Documentation

◆ _inputManager

InputManager MoreMountains.TopDownEngine.CharacterSwitchManager._inputManager
protected

◆ _instantiatedCharacters

Character [] MoreMountains.TopDownEngine.CharacterSwitchManager._instantiatedCharacters
protected

◆ _instantiatedVFX

ParticleSystem MoreMountains.TopDownEngine.CharacterSwitchManager._instantiatedVFX
protected

◆ _switchEvent

TopDownEngineEvent MoreMountains.TopDownEngine.CharacterSwitchManager._switchEvent = new TopDownEngineEvent(TopDownEngineEventTypes.CharacterSwitch, null)
protected

◆ CharacterPrefabs

Character [] MoreMountains.TopDownEngine.CharacterSwitchManager.CharacterPrefabs

the list of possible characters prefabs to switch to

◆ CharacterSwitchVFX

ParticleSystem MoreMountains.TopDownEngine.CharacterSwitchManager.CharacterSwitchVFX

a particle system to play when a character gets changed

◆ CommonHealth

bool MoreMountains.TopDownEngine.CharacterSwitchManager.CommonHealth

if this is true, current health value will be passed from character to character

◆ CurrentIndex

int MoreMountains.TopDownEngine.CharacterSwitchManager.CurrentIndex = 0

the initial (and at runtime, current) index of the character prefab

◆ NextCharacterChoice

NextCharacterChoices MoreMountains.TopDownEngine.CharacterSwitchManager.NextCharacterChoice = NextCharacterChoices.Sequential

the order in which to pick the next character


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