分离Parameter为Common Parameter和会随着游戏State改变的Parameter。
将不需要public的一些变量改为private。
This commit is contained in:
@@ -6,21 +6,30 @@ public class MouseInMap : MonoBehaviour
|
||||
public float targetDistanceThreshold = 6f;
|
||||
public float enemyDistanceThreshold = 1f;
|
||||
|
||||
public Camera playCamera;
|
||||
public GameObject AgentObj;
|
||||
public GameObject environmentObj;
|
||||
public GameObject mousePreviewObj;
|
||||
public GameObject enemyContainerObj;
|
||||
public GameObject sceneBlockContainerObj;
|
||||
public GameObject targetControllerObj;
|
||||
public GameObject parameterContainerObj;
|
||||
public GameObject HUDObj;
|
||||
[SerializeField]
|
||||
private Camera playCamera;
|
||||
[SerializeField]
|
||||
private GameObject AgentObj;
|
||||
[SerializeField]
|
||||
private GameObject environmentObj;
|
||||
[SerializeField]
|
||||
private GameObject mousePreviewObj;
|
||||
[SerializeField]
|
||||
private GameObject enemyContainerObj;
|
||||
[SerializeField]
|
||||
private GameObject sceneBlockContainerObj;
|
||||
[SerializeField]
|
||||
private GameObject targetControllerObj;
|
||||
[SerializeField]
|
||||
private GameObject parameterContainerObj;
|
||||
[SerializeField]
|
||||
private GameObject HUDObj;
|
||||
|
||||
private Vector3 nowHitPosition = Vector3.zero;
|
||||
private Vector3 nowHitPositionRelative = Vector3.zero;
|
||||
private LayerMask groundMask;
|
||||
private int blockNum;
|
||||
private ParameterContainer paramCon;
|
||||
private CommonParameterContainer commonParamCon;
|
||||
private GameObject previewModel;
|
||||
private TargetController targetCon;
|
||||
private MousePreview mousePreviewCon;
|
||||
@@ -47,7 +56,7 @@ public class MouseInMap : MonoBehaviour
|
||||
|
||||
private void Start()
|
||||
{
|
||||
paramCon = parameterContainerObj.GetComponent<ParameterContainer>();
|
||||
commonParamCon = parameterContainerObj.GetComponent<CommonParameterContainer>();
|
||||
groundMask = LayerMask.GetMask("Ground");
|
||||
targetCon = targetControllerObj.GetComponent<TargetController>();
|
||||
mousePreviewCon = mousePreviewObj.GetComponent<MousePreview>();
|
||||
@@ -140,7 +149,7 @@ public class MouseInMap : MonoBehaviour
|
||||
// while blockLevel is not set, send error message
|
||||
messageCon.PushMessage(new List<string> { "[ERROR]MouseInMap:ChangeMouseMode:", "Level not set!", "mouseMode=", mouseMode.ToString() },
|
||||
new List<string> { messageCon.errorColor });
|
||||
blockLevel = paramCon.scenePrefabSet.GetLevelNumber(nowTargetType);
|
||||
blockLevel = commonParamCon.scenePrefabSet.GetLevelNumber(nowTargetType);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -152,7 +161,7 @@ public class MouseInMap : MonoBehaviour
|
||||
if (blockNum < 0)
|
||||
{
|
||||
// while blockNum is not set, random choose block type
|
||||
this.blockNum = Random.Range(0, paramCon.scenePrefabSet.GetBlockNumber(blockLevel, nowTargetType));
|
||||
this.blockNum = Random.Range(0, commonParamCon.scenePrefabSet.GetBlockNumber(blockLevel, nowTargetType));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -160,7 +169,7 @@ public class MouseInMap : MonoBehaviour
|
||||
this.blockNum = blockNum;
|
||||
}
|
||||
// set previewModel
|
||||
previewModel = paramCon.scenePrefabSet.GetPrefab(blockLevel, this.blockNum, nowTargetType);
|
||||
previewModel = commonParamCon.scenePrefabSet.GetPrefab(blockLevel, this.blockNum, nowTargetType);
|
||||
mousePreviewCon.ChangePreviewTo(previewModel);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user