Struct PlayerColor
Represents a color that may copy from CustomColors.
Inherited Members
Namespace: SlugBase.DataTypes
Assembly: SlugBase.dll
Syntax
public readonly struct PlayerColor
Constructors
PlayerColor(JsonAny)
Creates a new PlayerColor from JSON.
Declaration
public PlayerColor(JsonAny json)
Parameters
Type | Name | Description |
---|---|---|
JsonAny | json | The JSON to load. |
PlayerColor(String)
Creates a new PlayerColor.
Declaration
public PlayerColor(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the custom color to copy. |
PlayerColor(Color)
Creates a new PlayerColor.
Declaration
public PlayerColor(Color color)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Color | color | The color to return. |
Fields
Body
The body color of SlugBaseCharacters.
Declaration
public static readonly PlayerColor Body
Field Value
Type | Description |
---|---|
PlayerColor |
Eyes
The eye color of SlugBaseCharacters.
Declaration
public static readonly PlayerColor Eyes
Field Value
Type | Description |
---|---|
PlayerColor |
Methods
GetColor(PlayerGraphics)
Gets the value of this color for a player.
Declaration
public readonly Color? GetColor(PlayerGraphics playerGraphics)
Parameters
Type | Name | Description |
---|---|---|
PlayerGraphics | playerGraphics | The player to get the color from. |
Returns
Type | Description |
---|---|
System.Nullable<UnityEngine.Color> | The custom color, or |
GetCustomColor(PlayerGraphics, Int32)
Gets a color from the "custom_colors" feature by index for the given SlugBase character graphics.
Declaration
public static Color GetCustomColor(PlayerGraphics playerGraphics, int index)
Parameters
Type | Name | Description |
---|---|---|
PlayerGraphics | playerGraphics | The player graphics to get the color of. |
System.Int32 | index | The index of the custom color. |
Returns
Type | Description |
---|---|
UnityEngine.Color |
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
|
System.IndexOutOfRangeException |
|
GetCustomColor(PlayerGraphics, String)
Gets a color from the "custom_colors" feature by name for the given SlugBase character graphics.
Declaration
public static Color GetCustomColor(PlayerGraphics playerGraphics, string name)
Parameters
Type | Name | Description |
---|---|---|
PlayerGraphics | playerGraphics | The player graphics to get the color of. |
System.String | name | The name of the custom color. |
Returns
Type | Description |
---|---|
UnityEngine.Color |
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
|
System.Collections.Generic.KeyNotFoundException | No custom color was found matching |