(client) chore:Clean code
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
using System;
|
||||
using Managers;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Map
|
||||
@ -12,11 +10,12 @@ namespace Map
|
||||
{
|
||||
[SerializeField] private bool defaultOpen = false;
|
||||
|
||||
[SerializeField] [Tooltip("此维度的唯一标识符。如果为空,将使用GameObject的名称。")]
|
||||
[SerializeField]
|
||||
[Tooltip("此维度的唯一标识符。如果为空,将使用GameObject的名称。")]
|
||||
private string _dimensionId;
|
||||
|
||||
[SerializeField] public MapGenerator mapGenerator;
|
||||
|
||||
|
||||
public Vector3 cameraPosition;
|
||||
/// <summary>
|
||||
/// 获取此维度的唯一标识符。
|
||||
@ -43,7 +42,7 @@ namespace Map
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
|
||||
// 1. 确保 DimensionId 已初始化,这会触发 DimensionId 属性的 getter 逻辑
|
||||
var id = DimensionId;
|
||||
// 2. 创建一个用于存放此维度下所有实体的根GameObject,方便管理
|
||||
@ -60,7 +59,7 @@ namespace Map
|
||||
Debug.LogError(
|
||||
"[Dimension] Program.Instance is null during Dimension Awake. Cannot register dimension.", this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 5. 处理 defaultOpen 逻辑,设置Program的焦点维度
|
||||
// 确保在自身注册到 Program 之后再设置焦点,这样 Program 内部才能找到它
|
||||
@ -74,7 +73,7 @@ namespace Map
|
||||
private void Start()
|
||||
{
|
||||
var size = mapGenerator.baseMap.GetSize();
|
||||
cameraPosition = new Vector3(size.x / 2f, size.y / 2f, -10)+transform.position;
|
||||
cameraPosition = new Vector3(size.x / 2f, size.y / 2f, -10) + transform.position;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
|
Reference in New Issue
Block a user