Table of Contents

Class LayerConstants

Namespace
Framework.Common.Constants
Assembly
Assembly-CSharp.dll

Unity Layer 번호 상수. 매직 넘버 제거.

public static class LayerConstants
Inheritance
object
LayerConstants

Remarks

Physics.Raycast의 layerMask 파라미터에는 LayerConstants.Mask()로 마스크를 생성해 사용한다. Layer 번호 변경 시 이 파일만 수정하면 된다.

Fields

Default

public const int Default = 0

Field Value

int

Enemy

public const int Enemy = 9

Field Value

int

Ground

public const int Ground = 10

Field Value

int

Player

public const int Player = 8

Field Value

int

UI

public const int UI = 5

Field Value

int

Methods

Mask(params int[])

여러 레이어 번호로 LayerMask 비트 마스크 생성.

public static int Mask(params int[] layers)

Parameters

layers int[]

포함할 Layer 번호 목록.

Returns

int

합산된 LayerMask 정수값.

Examples

int mask = LayerConstants.Mask(LayerConstants.Player, LayerConstants.Enemy);
Physics.Raycast(origin, dir, 100f, mask);