1
This commit is contained in:
@@ -14,6 +14,10 @@ namespace IndianOceanAssets.Engine2_5D
|
||||
[SerializeField] private float intensity = 1f; // 光照强度 (0~1)
|
||||
[SerializeField] private bool registerOnStart = true;
|
||||
|
||||
[Header("位置调整")]
|
||||
[Tooltip("光源相对于物体(或 followTarget)的位置偏移")]
|
||||
[SerializeField] private Vector3 offset;
|
||||
|
||||
[Header("可选:目标跟随(留空则跟随自身)")]
|
||||
[SerializeField] private Transform followTarget;
|
||||
|
||||
@@ -45,12 +49,13 @@ namespace IndianOceanAssets.Engine2_5D
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回光源在世界坐标的位置(XZ 平面)
|
||||
/// 返回光源在世界坐标的位置(XZ 平面),含 offset 偏移
|
||||
/// </summary>
|
||||
public Vector2 GetWorldPositionXZ()
|
||||
{
|
||||
Transform t = followTarget != null ? followTarget : transform;
|
||||
return new Vector2(t.position.x, t.position.z);
|
||||
Vector3 pos = t.position + offset;
|
||||
return new Vector2(pos.x, pos.z);
|
||||
}
|
||||
|
||||
public float Radius => radius;
|
||||
@@ -103,4 +108,4 @@ namespace IndianOceanAssets.Engine2_5D
|
||||
LightMaskSystem.Instance.UnregisterLight(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user