Struct PlayerColor
- Namespace
- Unity.Multiplayer.Core
A player's chosen colour as 8-bit RGBA, engine-free so Core can carry it in the approval payload.
The adapter converts it to and from UnityEngine.Color32.
public readonly struct PlayerColor : IEquatable<PlayerColor>
- Implements
- Inherited Members
Constructors
PlayerColor(byte, byte, byte, byte)
Builds a colour from its channels; alpha defaults to opaque.
public PlayerColor(byte r, byte g, byte b, byte a = 255)
Parameters
Properties
A
Alpha channel; 255 is opaque.
public byte A { get; }
Property Value
B
Blue channel.
public byte B { get; }
Property Value
G
Green channel.
public byte G { get; }
Property Value
R
Red channel.
public byte R { get; }
Property Value
White
Opaque white.
public static PlayerColor White { get; }
Property Value
Methods
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
Equals(PlayerColor)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(PlayerColor other)
Parameters
otherPlayerColorAn object to compare with this object.
Returns
FromRgba32(uint)
Unpacks a 0xRRGGBBAA value.
public static PlayerColor FromRgba32(uint rgba)
Parameters
rgbauint
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToRgba32()
Packs the colour as 0xRRGGBBAA.
public uint ToRgba32()
Returns
ToString()
#RRGGBBAA in upper-case hex.
public override string ToString()
Returns
Operators
operator ==(PlayerColor, PlayerColor)
Equality.
public static bool operator ==(PlayerColor left, PlayerColor right)
Parameters
leftPlayerColorrightPlayerColor
Returns
operator !=(PlayerColor, PlayerColor)
Inequality.
public static bool operator !=(PlayerColor left, PlayerColor right)
Parameters
leftPlayerColorrightPlayerColor