Table of Contents

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>, 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

character LayeredCharacter

The character to create a copy of.

Exceptions

ArgumentNullException

Thrown when character is null.

ArgumentException

Thrown when BlazerTech.CharacterManagement.Characters.CharacterBase`2.IsValidCharacter in argument character is false.

LayeredCharacter(LayeredCharacter_DTO)

Create a new character from a character Data Transfer Object (DTO).

public LayeredCharacter(LayeredCharacter.LayeredCharacter_DTO character_DTO)

Parameters

character_DTO LayeredCharacter.LayeredCharacter_DTO

The 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

template LayeredCharacterTemplateSO

Exceptions

ArgumentNullException

Thrown when template is null.

ArgumentException

Thrown when template is invalid.

LayeredCharacter(string, LayeredCharacterTypeSO, string)

Create new blank character.

public LayeredCharacter(string characterName, LayeredCharacterTypeSO characterType, string displayName = "")

Parameters

characterName string

Name of the new character.

characterType LayeredCharacterTypeSO

The LayeredCharacterTypeSO the character will use.

displayName string

Exceptions

ArgumentException

Thrown when characterType is null or invalid.

Properties

Layers

public IReadOnlyList<CharacterLayer> Layers { get; }

Property Value

IReadOnlyList<CharacterLayer>

Methods

ApplySnapshot(LayeredCharacterSnapshot)

Set the CharacterLayerOption's inside Layers equal to those inside a LayeredCharacterSnapshot.

public void ApplySnapshot(LayeredCharacterSnapshot snapshot)

Parameters

snapshot LayeredCharacterSnapshot

The LayeredCharacterSnapshot to apply to the character.

Exceptions

ArgumentException

LoadCharacterHandler()

protected override void LoadCharacterHandler()

LoadCharacterHandlerAsync()

protected override Task LoadCharacterHandlerAsync()

Returns

Task

OverrideLayerOptions(LayeredCharacter)

Sets the characters Layers equal to the same Layers of another LayeredCharacter.

public bool OverrideLayerOptions(LayeredCharacter character)

Parameters

character LayeredCharacter

Returns

bool

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

true if the character passes all validation checks; otherwise, false.

Remarks

Validation steps:

  1. Calls the base IsValid method to validate the CharacterName and CharacterType.
  2. Verifies that the CMSInitializationHandler has completed initialization first.
  3. 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

bool

UnloadCharacterHandler()

protected override void UnloadCharacterHandler()

Events

OnLayerOptionsOverriden

public event EventHandler OnLayerOptionsOverriden

Event Type

EventHandler

See Also