Struct PhysicsLayer
Identifies one physics layer by index.
[MemoryPackable(GenerateType.Object)]
public struct PhysicsLayer : IEquatable<PhysicsLayer>, IMemoryPackable<PhysicsLayer>, IMemoryPackFormatterRegister
- Implements
-
IMemoryPackable<PhysicsLayer>IMemoryPackFormatterRegister
- Inherited Members
Remarks
MemoryPack GenerateType: unmanaged
int _index
Constructors
PhysicsLayer(int, string?)
Creates a physics layer and optionally registers its display name.
public PhysicsLayer(int index, string? layerName = null)
Parameters
Fields
LayerNamesCache
Maps registered layer indices to their names.
public static SwiftDictionary<int, string> LayerNamesCache
Field Value
MaxIndex
Maximum valid physics layer index.
public const int MaxIndex = 31
Field Value
MinIndex
Minimum valid physics layer index.
public const int MinIndex = 0
Field Value
Properties
Index
Gets the layer index.
[JsonIgnore]
[MemoryPackIgnore]
public readonly int Index { get; }
Property Value
MaskBit
Gets the single bit corresponding to this layer index.
[JsonIgnore]
[MemoryPackIgnore]
public readonly int MaskBit { get; }
Property Value
Methods
Equals(PhysicsLayer)
public readonly bool Equals(PhysicsLayer other)
Parameters
otherPhysicsLayer
Returns
Equals(object?)
public override readonly bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override readonly int GetHashCode()
Returns
LayerToName(int)
Given a layer number, returns the registered layer name.
public static string? LayerToName(int layer)
Parameters
layerint
Returns
NameToLayer(string)
Given a layer name, returns the registered layer index or -1 if the layer name is invalid.
public static int NameToLayer(string layerName)
Parameters
layerNamestring
Returns
Set(int)
Replaces the layer index after validating its range.
public void Set(int index)
Parameters
indexint
ToString()
public override readonly string ToString()
Returns
Operators
operator ==(PhysicsLayer, PhysicsLayer)
Determines whether two physics layers have the same index.
public static bool operator ==(PhysicsLayer left, PhysicsLayer right)
Parameters
leftPhysicsLayerrightPhysicsLayer
Returns
operator !=(PhysicsLayer, PhysicsLayer)
Determines whether two physics layers have different indices.
public static bool operator !=(PhysicsLayer left, PhysicsLayer right)
Parameters
leftPhysicsLayerrightPhysicsLayer