Class LayeredCharacter
- Namespace
- BlazerTech.CharacterManagement.Characters
- Assembly
- Assembly-CSharp.dll
Represents a character made of multiple modular layers, such as body, outfit, hairstyle, etc. Each layer can be placed on top of each other in order to create the final character.
public class LayeredCharacter : CharacterBase<LayeredCharacterTypeSO, LayeredCharacter.LoadedLayeredCharacterHandler>, ICharacter<LayeredCharacterTypeSO, LayeredCharacter.LoadedLayeredCharacterHandler>, IValidatable
- Inheritance
-
LayeredCharacter
- Implements
- Inherited Members
Remarks
A LayeredCharacter is tied to a LayeredCharacterTypeSO, which defines the base spritesheet and animator controller used. It also defines the layers the character must include. Each equipped layer is represented by a CharacterLayer, which references one option in a CharacterLayerDefinitionSO asset.
Constructors
LayeredCharacter(LayeredCharacter)
Duplicate Character.
public LayeredCharacter(LayeredCharacter character)
Parameters
characterLayeredCharacterThe character to create a copy of.
Exceptions
- ArgumentNullException
Thrown when
characteris null.- ArgumentException
Thrown when BlazerTech.CharacterManagement.Characters.CharacterBase`2.IsValidCharacter in argument
characteris false.
LayeredCharacter(LayeredCharacter_DTO)
Create a new character from a character Data Transfer Object (DTO).
public LayeredCharacter(LayeredCharacter.LayeredCharacter_DTO character_DTO)
Parameters
character_DTOLayeredCharacter.LayeredCharacter_DTOThe Data Transfer Object used to create the character.
Remarks
Used to re-created characters saved in previous sessions.
LayeredCharacter(LayeredCharacterTemplateSO)
Create Character from Template.
public LayeredCharacter(LayeredCharacterTemplateSO template)
Parameters
templateLayeredCharacterTemplateSO
Exceptions
- ArgumentNullException
Thrown when
templateis null.- ArgumentException
Thrown when
templateis invalid.
LayeredCharacter(string, LayeredCharacterTypeSO, string, LayeredCharacterCreationMode)
Create a new layered character with either default or randomized layer options.
public LayeredCharacter(string characterName, LayeredCharacterTypeSO characterType, string displayName = "", LayeredCharacterCreationMode creationMode = LayeredCharacterCreationMode.DefaultLayerOptions)
Parameters
characterNamestringName of the new character.
characterTypeLayeredCharacterTypeSOThe LayeredCharacterTypeSO the character will use.
displayNamestringOptional name used when displaying the character.
creationModeLayeredCharacterCreationModeUse default layer options or randomized layer options.
Exceptions
- ArgumentException
Thrown when
characterTypeis null or invalid.
Properties
Layers
public IReadOnlyList<CharacterLayer> Layers { get; }
Property Value
Methods
ApplySnapshot(LayeredCharacterSnapshot)
Set the CharacterLayerOption's inside Layers equal to those inside a LayeredCharacterSnapshot.
public void ApplySnapshot(LayeredCharacterSnapshot snapshot)
Parameters
snapshotLayeredCharacterSnapshotThe LayeredCharacterSnapshot to apply to the character.
Exceptions
LoadCharacterHandler()
protected override void LoadCharacterHandler()
LoadCharacterHandlerAsync()
protected override Task LoadCharacterHandlerAsync()
Returns
OverrideLayerOptions(LayeredCharacter)
Sets the characters Layers equal to the same Layers of another LayeredCharacter.
public bool OverrideLayerOptions(LayeredCharacter character)
Parameters
characterLayeredCharacter
Returns
PerformValidationCheck()
Determines whether the current LayeredCharacter instance is valid, extending the base IsValid checks with additional requirements specific to layered characters.
public override bool PerformValidationCheck()
Returns
- bool
trueif the character passes all validation checks; otherwise,false.
Remarks
Validation steps:
- Calls the base IsValid method to validate the CharacterName and CharacterType.
- Verifies that the CMSInitializationHandler has completed initialization first.
- Checks that Layers matches the same layer count in CharacterType.
- See Also
RandomizeAllLayers()
Randomize every layer in the BlazerTech.CharacterManagement.Characters.LayeredCharacter.layers list.
public bool RandomizeAllLayers()
Returns
UnloadCharacterHandler()
protected override void UnloadCharacterHandler()
Events
OnLayerOptionsOverriden
public event EventHandler OnLayerOptionsOverriden