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...
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
◆ NextCharacterChoices
the possible orders the next character can be selected from
Enumerator |
---|
Sequential | |
Random | |
◆ 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
◆ _inputManager
InputManager MoreMountains.TopDownEngine.CharacterSwitchManager._inputManager |
|
protected |
◆ _instantiatedCharacters
Character [] MoreMountains.TopDownEngine.CharacterSwitchManager._instantiatedCharacters |
|
protected |
◆ _instantiatedVFX
ParticleSystem MoreMountains.TopDownEngine.CharacterSwitchManager._instantiatedVFX |
|
protected |
◆ _switchEvent
◆ 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
the order in which to pick the next character
The documentation for this class was generated from the following file: