摄像机区域的架构改动
This commit is contained in:
52
Assets/_Game/Scripts/World/Liquid/LiquidZone.cs
Normal file
52
Assets/_Game/Scripts/World/Liquid/LiquidZone.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
// Assets/Scripts/World/Liquid/LiquidZone.cs
|
||||
using BaseGames.Core.Events;
|
||||
using BaseGames.Feedback;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BaseGames.World.Liquid
|
||||
{
|
||||
/// <summary>
|
||||
/// 挂在液态区域根 GameObject 上。
|
||||
/// 酸液/熔岩时需同时挂载 HazardZone(InstantKill 类型)。
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Collider2D))]
|
||||
public class LiquidZone : MonoBehaviour
|
||||
{
|
||||
[Header("液体类型")]
|
||||
[SerializeField] private LiquidType _liquidType = LiquidType.Water;
|
||||
|
||||
[Header("区域标识(存档/跨系统识别)")]
|
||||
[SerializeField] private string _zoneId;
|
||||
|
||||
[Header("伤害(Acid/Lava 由子节点 HazardZone 处理;Water 类型溺死由 WaterDangerState 处理)")]
|
||||
|
||||
[Header("物理配置")]
|
||||
[SerializeField] private LiquidPhysicsConfigSO _physicsConfig;
|
||||
|
||||
[Header("Event Channels")]
|
||||
[SerializeField] private LiquidEventChannelSO _onPlayerEntered;
|
||||
[SerializeField] private LiquidEventChannelSO _onPlayerExited;
|
||||
|
||||
[Header("Feedback")]
|
||||
[SerializeField] private SceneFeedback _splashEnterFeedback;
|
||||
[SerializeField] private SceneFeedback _splashExitFeedback;
|
||||
|
||||
public LiquidType Type => _liquidType;
|
||||
public LiquidPhysicsConfigSO Physics => _physicsConfig;
|
||||
public string ZoneId => _zoneId;
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag("Player")) return;
|
||||
_splashEnterFeedback?.Play();
|
||||
_onPlayerEntered?.Raise(new LiquidEvent(_zoneId, _liquidType));
|
||||
}
|
||||
|
||||
private void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag("Player")) return;
|
||||
_splashExitFeedback?.Play();
|
||||
_onPlayerExited?.Raise(new LiquidEvent(_zoneId, _liquidType));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user