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 | |
◆ DebugCharacterSwitchToTargetIndex()
virtual void MoreMountains.CorgiEngine.CharacterSwitchManager.DebugCharacterSwitchToTargetIndex |
( |
| ) |
|
|
protectedvirtual |
A test method that switches to the specified debug index
◆ DetermineNextIndex()
virtual void MoreMountains.CorgiEngine.CharacterSwitchManager.DetermineNextIndex |
( |
| ) |
|
|
protectedvirtual |
Determines the next index to go to based on the choice mode settings
◆ ForceCharacterSwitch()
virtual void MoreMountains.CorgiEngine.CharacterSwitchManager.ForceCharacterSwitch |
( |
| ) |
|
|
virtual |
A public method you can use to switch to the next character in the rotation
◆ ForceCharacterSwitchTo()
virtual void MoreMountains.CorgiEngine.CharacterSwitchManager.ForceCharacterSwitchTo |
( |
int |
newIndex | ) |
|
|
virtual |
A public method you can use to switch to a specific character in the array
- Parameters
-
◆ GetInputManager()
virtual void MoreMountains.CorgiEngine.CharacterSwitchManager.GetInputManager |
( |
| ) |
|
|
protectedvirtual |
We grab the corresponding input manager
◆ InstantiateCharacters()
virtual void MoreMountains.CorgiEngine.CharacterSwitchManager.InstantiateCharacters |
( |
| ) |
|
|
protectedvirtual |
Instantiates and disables all characters in our list
◆ InstantiateVFX()
virtual void MoreMountains.CorgiEngine.CharacterSwitchManager.InstantiateVFX |
( |
| ) |
|
|
protectedvirtual |
Instantiates and disables the particle system if needed
◆ OperateSwitch()
virtual IEnumerator MoreMountains.CorgiEngine.CharacterSwitchManager.OperateSwitch |
( |
| ) |
|
|
protectedvirtual |
A coroutine that changes the character, triggers an event, and sets its Health
- Returns
◆ Start()
virtual void MoreMountains.CorgiEngine.CharacterSwitchManager.Start |
( |
| ) |
|
|
protectedvirtual |
On Awake we grab our input manager and instantiate our characters and VFX
◆ SwitchCharacter() [1/2]
virtual IEnumerator MoreMountains.CorgiEngine.CharacterSwitchManager.SwitchCharacter |
( |
| ) |
|
|
protectedvirtual |
Switches to the next character in the list
◆ SwitchCharacter() [2/2]
virtual IEnumerator MoreMountains.CorgiEngine.CharacterSwitchManager.SwitchCharacter |
( |
int |
newIndex | ) |
|
|
protectedvirtual |
A coroutine to switch to a specific index
- Parameters
-
- Returns
◆ Update()
virtual void MoreMountains.CorgiEngine.CharacterSwitchManager.Update |
( |
| ) |
|
|
protectedvirtual |
On Update we watch for our input
◆ _instantiatedCharacters
Character [] MoreMountains.CorgiEngine.CharacterSwitchManager._instantiatedCharacters |
|
protected |
◆ _instantiatedVFX
ParticleSystem MoreMountains.CorgiEngine.CharacterSwitchManager._instantiatedVFX |
|
protected |
◆ _switchEvent
◆ CharacterPrefabs
Character [] MoreMountains.CorgiEngine.CharacterSwitchManager.CharacterPrefabs |
the list of possible characters prefabs to switch to
◆ CharacterSwitchVFX
ParticleSystem MoreMountains.CorgiEngine.CharacterSwitchManager.CharacterSwitchVFX |
a particle system to play when a character gets changed
◆ CommonHealth
bool MoreMountains.CorgiEngine.CharacterSwitchManager.CommonHealth |
if this is true, current health value will be passed from character to character
◆ CurrentIndex
int MoreMountains.CorgiEngine.CharacterSwitchManager.CurrentIndex = 0 |
the initial (and at runtime, current) index of the character prefab
◆ DebugCharacterSwitchToTargetIndexButton
bool MoreMountains.CorgiEngine.CharacterSwitchManager.DebugCharacterSwitchToTargetIndexButton |
a test button that forces a character switch to the specified index in DebugTargetIndex
◆ DebugTargetIndex
int MoreMountains.CorgiEngine.CharacterSwitchManager.DebugTargetIndex = 1 |
the index that will be used when pressing the DebugCharacterSwitchToTargetIndex button below
◆ ForceCharacterSwitchButton
bool MoreMountains.CorgiEngine.CharacterSwitchManager.ForceCharacterSwitchButton |
a test button that forces a character switch
◆ LinkedInputManager
InputManager MoreMountains.CorgiEngine.CharacterSwitchManager.LinkedInputManager |
the input manager we'll read input on
◆ MaintainPreviousCharacterFacingDirection
bool MoreMountains.CorgiEngine.CharacterSwitchManager.MaintainPreviousCharacterFacingDirection = false |
if this is true, newly switched to characters will flip (if needed) to face the direction the previous character was facing
◆ NextCharacterChoice
the order in which to pick the next character
◆ PlayerID
string MoreMountains.CorgiEngine.CharacterSwitchManager.PlayerID = "Player1" |
◆ PlayerIndex
int MoreMountains.CorgiEngine.CharacterSwitchManager.PlayerIndex = 0 |
the index of the Player in the LevelManager we want to target
The documentation for this class was generated from the following file: