83 lines
1.6 KiB
C#
83 lines
1.6 KiB
C#
using UnityEngine;
|
|
|
|
public sealed class vp_Layer
|
|
{
|
|
public static class Mask
|
|
{
|
|
public static int BulletBlockers = ~(0x6D000014 | ((1 << LayerMask.NameToLayer("PlayerCollider")) | (1 << LayerMask.NameToLayer("Weapon"))));
|
|
|
|
public static int ExternalBlockers = -1757413397;
|
|
|
|
public static int PhysicsBlockers = 1344274432;
|
|
|
|
public static int IgnoreWalkThru = -754974741;
|
|
}
|
|
|
|
public static readonly vp_Layer instance;
|
|
|
|
public const int Default = 0;
|
|
|
|
public const int TransparentFX = 1;
|
|
|
|
public const int IgnoreRaycast = 2;
|
|
|
|
public const int Water = 4;
|
|
|
|
public const int MovableObject = 21;
|
|
|
|
public const int Ragdoll = 22;
|
|
|
|
public const int RemotePlayer = 23;
|
|
|
|
public const int IgnoreBullets = 24;
|
|
|
|
public const int Enemy = 25;
|
|
|
|
public const int Pickup = 26;
|
|
|
|
public const int Trigger = 27;
|
|
|
|
public const int MovingPlatform = 28;
|
|
|
|
public const int Debris = 29;
|
|
|
|
public const int LocalPlayer = 30;
|
|
|
|
public const int Weapon = 31;
|
|
|
|
static vp_Layer()
|
|
{
|
|
instance = new vp_Layer();
|
|
Physics.IgnoreLayerCollision(30, 29);
|
|
Physics.IgnoreLayerCollision(29, 29);
|
|
Physics.IgnoreLayerCollision(22, 23);
|
|
}
|
|
|
|
private vp_Layer()
|
|
{
|
|
}
|
|
|
|
public static void Set(GameObject obj, int layer, bool recursive = false)
|
|
{
|
|
if (layer < 0 || layer > 31)
|
|
{
|
|
Debug.LogError("vp_Layer: Attempted to set layer id out of range [0-31].");
|
|
return;
|
|
}
|
|
obj.layer = layer;
|
|
if (!recursive)
|
|
{
|
|
return;
|
|
}
|
|
foreach (Transform item in obj.transform)
|
|
{
|
|
Set(item.gameObject, layer, true);
|
|
}
|
|
}
|
|
|
|
public static bool IsInMask(int layer, int layerMask)
|
|
{
|
|
return (layerMask & (1 << layer)) == 0;
|
|
}
|
|
}
|