Table of Contents

Struct PhysicsLayer

Namespace
Gravitas.Support
Assembly
Gravitas.dll

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

index int
layerName string

Fields

LayerNamesCache

Maps registered layer indices to their names.

public static SwiftDictionary<int, string> LayerNamesCache

Field Value

SwiftDictionary<int, string>

MaxIndex

Maximum valid physics layer index.

public const int MaxIndex = 31

Field Value

int

MinIndex

Minimum valid physics layer index.

public const int MinIndex = 0

Field Value

int

Properties

Index

Gets the layer index.

[JsonIgnore]
[MemoryPackIgnore]
public readonly int Index { get; }

Property Value

int

MaskBit

Gets the single bit corresponding to this layer index.

[JsonIgnore]
[MemoryPackIgnore]
public readonly int MaskBit { get; }

Property Value

int

Methods

Equals(PhysicsLayer)

public readonly bool Equals(PhysicsLayer other)

Parameters

other PhysicsLayer

Returns

bool

Equals(object?)

public override readonly bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override readonly int GetHashCode()

Returns

int

LayerToName(int)

Given a layer number, returns the registered layer name.

public static string? LayerToName(int layer)

Parameters

layer int

Returns

string

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

layerName string

Returns

int

Set(int)

Replaces the layer index after validating its range.

public void Set(int index)

Parameters

index int

ToString()

public override readonly string ToString()

Returns

string

Operators

operator ==(PhysicsLayer, PhysicsLayer)

Determines whether two physics layers have the same index.

public static bool operator ==(PhysicsLayer left, PhysicsLayer right)

Parameters

left PhysicsLayer
right PhysicsLayer

Returns

bool

operator !=(PhysicsLayer, PhysicsLayer)

Determines whether two physics layers have different indices.

public static bool operator !=(PhysicsLayer left, PhysicsLayer right)

Parameters

left PhysicsLayer
right PhysicsLayer

Returns

bool