|
|
@ -14,6 +14,10 @@ public class MapManager : Singleton<MapManager> |
|
|
|
|
|
|
|
|
public GameObject generatePoint; |
|
|
public GameObject generatePoint; |
|
|
|
|
|
|
|
|
|
|
|
public GameObject generatePointTest; |
|
|
|
|
|
|
|
|
|
|
|
public GameObject cameraObject; |
|
|
|
|
|
|
|
|
public Vector3 lineOffSet; |
|
|
public Vector3 lineOffSet; |
|
|
public Vector3 columnOffSet; |
|
|
public Vector3 columnOffSet; |
|
|
|
|
|
|
|
|
@ -175,7 +179,7 @@ public class MapManager : Singleton<MapManager> |
|
|
bookAnim.GetComponent<Animator>().SetTrigger("move"); |
|
|
bookAnim.GetComponent<Animator>().SetTrigger("move"); |
|
|
//书缝愈合
|
|
|
//书缝愈合
|
|
|
//bookUpAnim.SetActive(true);
|
|
|
//bookUpAnim.SetActive(true);
|
|
|
|
|
|
StartCoroutine(GenerateProcessTest()); |
|
|
enemyBurn(PlayerStatsManager.Instance.levelDevelopData.fightEenemyPool); |
|
|
enemyBurn(PlayerStatsManager.Instance.levelDevelopData.fightEenemyPool); |
|
|
} |
|
|
} |
|
|
//总动画控制进程
|
|
|
//总动画控制进程
|
|
|
@ -193,6 +197,45 @@ public class MapManager : Singleton<MapManager> |
|
|
yield return new WaitForSeconds(2); |
|
|
yield return new WaitForSeconds(2); |
|
|
yield return StartCoroutine(EnemyGenerate()); |
|
|
yield return StartCoroutine(EnemyGenerate()); |
|
|
yield return StartCoroutine(CompleteGenerate()); |
|
|
yield return StartCoroutine(CompleteGenerate()); |
|
|
|
|
|
CardManager.createCardImageMap(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IEnumerator GenerateProcessTest() |
|
|
|
|
|
{ |
|
|
|
|
|
yield return StartCoroutine(MapGenerateTest()); |
|
|
|
|
|
// yield return StartCoroutine(MapGenerateDefault());
|
|
|
|
|
|
yield return StartCoroutine(SetUpMapUnityForTool()); |
|
|
|
|
|
//yield return StartCoroutine(UPMoveMapUnity());
|
|
|
|
|
|
//yield return new WaitForSeconds(2);
|
|
|
|
|
|
//yield return StartCoroutine(EnemyGenerate());
|
|
|
|
|
|
//yield return StartCoroutine(CompleteGenerate());
|
|
|
|
|
|
createCameraAboveObject(GameManager.Instance.ToolX[3].Y[3].gameObject, 10.0f, 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void createCameraAboveObject(GameObject targetObject, float heightAbove, float lookDownAngle) |
|
|
|
|
|
{ |
|
|
|
|
|
// 1. 创建摄像机
|
|
|
|
|
|
cameraObject = new GameObject("RenderCamera"); |
|
|
|
|
|
Camera renderCamera = cameraObject.AddComponent<Camera>(); |
|
|
|
|
|
|
|
|
|
|
|
// 设置摄像机参数
|
|
|
|
|
|
renderCamera.clearFlags = CameraClearFlags.SolidColor; // 清除背景颜色
|
|
|
|
|
|
renderCamera.backgroundColor = Color.clear; // 背景透明
|
|
|
|
|
|
renderCamera.orthographic = true; // 正交投影
|
|
|
|
|
|
renderCamera.orthographicSize = 5; |
|
|
|
|
|
renderCamera.enabled = false; |
|
|
|
|
|
// RenderTexture renderTexture = new RenderTexture(512, 512, 24);
|
|
|
|
|
|
//renderCamera.targetTexture = renderTexture;
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 设置摄像机位置:目标物体上方
|
|
|
|
|
|
Vector3 targetPosition = targetObject.transform.position; |
|
|
|
|
|
cameraObject.transform.position = targetPosition + new Vector3(0, heightAbove, 0); |
|
|
|
|
|
|
|
|
|
|
|
// 3. 设置摄像机朝向:向下看目标物体
|
|
|
|
|
|
cameraObject.transform.LookAt(targetPosition); |
|
|
|
|
|
|
|
|
|
|
|
// 4. 调整倾斜角度(可选)
|
|
|
|
|
|
cameraObject.transform.Rotate(lookDownAngle, 0, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//完成场地创建
|
|
|
//完成场地创建
|
|
|
@ -232,6 +275,19 @@ public class MapManager : Singleton<MapManager> |
|
|
} |
|
|
} |
|
|
yield return null; |
|
|
yield return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IEnumerator SetUpMapUnityForTool() |
|
|
|
|
|
{ |
|
|
|
|
|
// yield return StartCoroutine(MapGenerate());
|
|
|
|
|
|
for (int i = 0; i < GameManager.Instance.ToolX.Count; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
for (int j = 0; j < GameManager.Instance.ToolX[i].Y.Count; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
GameManager.Instance.ToolX[i].Y[j].StartRegiste(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
yield return null; |
|
|
|
|
|
} |
|
|
IEnumerator MapGenerate() |
|
|
IEnumerator MapGenerate() |
|
|
{ |
|
|
{ |
|
|
for (int i = 0; i < line; i++) |
|
|
for (int i = 0; i < line; i++) |
|
|
@ -301,6 +357,77 @@ public class MapManager : Singleton<MapManager> |
|
|
}*/ |
|
|
}*/ |
|
|
#endregion
|
|
|
#endregion
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IEnumerator MapGenerateTest() |
|
|
|
|
|
{ |
|
|
|
|
|
for (int i = 0; i < line; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (i != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
generatePointTest.transform.position += columnOffSet; |
|
|
|
|
|
} |
|
|
|
|
|
generatePointTest.transform.position = new Vector3(20, 20, generatePointTest.transform.position.z); |
|
|
|
|
|
|
|
|
|
|
|
int currentColumn = column; |
|
|
|
|
|
if (i != 0 && i % 2 != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
currentColumn = column - 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < currentColumn; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (i % 2 != 0 && j == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
generatePointTest.transform.position += lineOffSet / 2f; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var a = Instantiate(mapUnity, generatePointTest.transform.position - new Vector3(0, 2, 0), mapUnity.transform.rotation); |
|
|
|
|
|
MapUnity currentMapUnityScript = a.GetComponent<MapUnity>(); |
|
|
|
|
|
|
|
|
|
|
|
currentMapUnityScript.locationX = i; |
|
|
|
|
|
currentMapUnityScript.locationY = j; |
|
|
|
|
|
currentMapUnityScript.RegisterUnitForTool(); |
|
|
|
|
|
generatePointTest.transform.position += lineOffSet; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
yield return null; |
|
|
|
|
|
#region 隐藏多余节点
|
|
|
|
|
|
/* //隐藏多余节点
|
|
|
|
|
|
List<Yunit> X = GameManager.Instance.X; |
|
|
|
|
|
for (int i = 0; i < (int)(line / 2f); i++) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (i == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
X[i].Y[0].gameObject.SetActive(false); |
|
|
|
|
|
X[i].Y[1].gameObject.SetActive(false); |
|
|
|
|
|
X[i].Y[X[i].Y .Count -1].gameObject.SetActive(false); |
|
|
|
|
|
X[i].Y[X[i].Y.Count - 2].gameObject.SetActive(false); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
X[i].Y[0].gameObject.SetActive(false); |
|
|
|
|
|
X[i].Y[X[i].Y.Count - 1].gameObject.SetActive(false); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
for (int i = (int)(line / 2f)+1; i < line ; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (i == line -1) |
|
|
|
|
|
{ |
|
|
|
|
|
X[i].Y[0].gameObject.SetActive(false); |
|
|
|
|
|
X[i].Y[1].gameObject.SetActive(false); |
|
|
|
|
|
X[i].Y[X[i].Y.Count - 1].gameObject.SetActive(false); |
|
|
|
|
|
X[i].Y[X[i].Y.Count - 2].gameObject.SetActive(false); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
X[i].Y[0].gameObject.SetActive(false); |
|
|
|
|
|
X[i].Y[X[i].Y.Count - 1].gameObject.SetActive(false); |
|
|
|
|
|
} |
|
|
|
|
|
}*/ |
|
|
|
|
|
#endregion
|
|
|
|
|
|
} |
|
|
IEnumerator MapGenerateDefault() |
|
|
IEnumerator MapGenerateDefault() |
|
|
{ |
|
|
{ |
|
|
for (int i = 0; i < line; i++) |
|
|
for (int i = 0; i < line; i++) |
|
|
|