Files
BABA_YAGA/Assets/Third Parties/Opsive/UltimateCharacterController/Scripts/Character/CharacterLayerManager.cs
Scove 3e39117acc Consolidate third-party plugins into Assets/Plugins
Move and consolidate many third-party plugin files and metadata from various locations (notably Assets/Third Parties/Plugins 1 and scattered Opsive/Photon folders) into a unified Assets/Plugins directory. Includes DOTween, PrimeTween, Native/BackroomsNoise, Sirenix/Odin Inspector, and Opsive UltimateCharacterController/shared libs, plus updates to several .meta files and removal of obsolete installer/legacy files. This standardizes plugin layout and cleans up duplicate/obsolete assets.
2026-06-16 18:41:44 +07:00

49 lines
2.6 KiB
C#

/// ---------------------------------------------
/// Ultimate Character Controller
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.UltimateCharacterController.Character
{
using Opsive.UltimateCharacterController.Game;
using UnityEngine;
/// <summary>
/// Sets up custom layers for the character.
/// </summary>
public class CharacterLayerManager : MonoBehaviour
{
[Tooltip("Layer Mask that specifies the layer that the enemies use.")]
[SerializeField] protected LayerMask m_EnemyLayers = 1 << LayerManager.Enemy;
[Tooltip("Layer Mask that specifies any layers that are invisible to the character (such as water or invisible planes placed on top of stairs). ")]
[SerializeField] protected LayerMask m_InvisibleLayers = (1 << LayerManager.TransparentFX) | (1 << LayerManager.IgnoreRaycast) | (1 << LayerManager.UI) | (1 << LayerManager.VisualEffect) | (1 << LayerManager.Overlay) | (1 << LayerManager.SubCharacter);
[Tooltip("Layer mask that specifies any layers that represent a solid object (such as the ground or a moving platform).")]
[SerializeField] protected LayerMask m_SolidObjectLayers = ~((1 << LayerManager.IgnoreRaycast) | (1 << LayerManager.Water) | (1 << LayerManager.UI) | (1 << LayerManager.VisualEffect) | (1 << LayerManager.Overlay) | (1 << LayerManager.SubCharacter));
public LayerMask EnemyLayers { get { return m_EnemyLayers; } }
public LayerMask InvisibleLayers { get { return m_InvisibleLayers; } }
public LayerMask SolidObjectLayers { get { return m_SolidObjectLayers; } }
// Represents the mask that ignores any invisible objects.
public int IgnoreInvisibleLayers { get { return ~m_InvisibleLayers; } }
// Represents the mask that ignores any invisible objects and the character.
public int IgnoreInvisibleCharacterLayers { get { return ~(m_InvisibleLayers | m_CharacterLayer); } }
// Represents the mask that ignores any invisible objects and the character/water.
public int IgnoreInvisibleCharacterWaterLayers { get { return ~(m_InvisibleLayers | m_CharacterLayer | (1 << LayerManager.Water)); } }
private LayerMask m_CharacterLayer = 1 << LayerManager.Character;
public LayerMask CharacterLayer { get { return m_CharacterLayer; } }
/// <summary>
/// Setups the character layer.
/// </summary>
public void Awake()
{
m_CharacterLayer = 1 << gameObject.layer;
LayerManager.Initialize();
}
}
}