Initial commit: Client Doc docs Server Tools
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XGame
|
||||
{
|
||||
public class TerrainManager : MonoBehaviour
|
||||
{
|
||||
public static TerrainManager m_Instance = null;
|
||||
|
||||
//string heightMap = "res/scene/ground/create/height01.png";
|
||||
//string mixMap = "res/scene/ground/create/mix03.png";//"res/scene/ground/create/mix01.tga";
|
||||
string[] baseMap = { "res/scene/ground/mat/Ground_005_T.png", "res/scene/ground/mat/Ground_007_T.png",
|
||||
"res/scene/ground/mat/Ground_G003_T.png", "res/scene/ground/mat/Ground_003_T.tga" };
|
||||
string[] normalMap = { "res/scene/ground/mat/Ground_005_M.tga", "res/scene/ground/mat/Ground_G001_M.tga",
|
||||
"res/scene/ground/mat/Ground_G003_M.tga", "res/scene/ground/mat/Ground_003_M.tga" };
|
||||
|
||||
private TerrainObject m_TerrainObject;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
m_Instance = this;
|
||||
Debug.Log("TerrainManager Awake");
|
||||
}
|
||||
|
||||
public static IEnumerator Init()
|
||||
{
|
||||
if(m_Instance == null)
|
||||
Debug.Log("TerrainManager m_Instance == null");
|
||||
yield return m_Instance.LocalInit();
|
||||
}
|
||||
|
||||
private IEnumerator LocalInit()
|
||||
{
|
||||
m_TerrainObject = new TerrainObject();
|
||||
//yield return m_TerrainObject.CreateGroundObjectFromPic(0, 0, heightMap, mixMap, baseMap, normalMap, gameObject.transform);
|
||||
yield break;
|
||||
}
|
||||
|
||||
//heightMap 高度图
|
||||
//mixMap 混合图
|
||||
//baseMap 基础地表纹理图列表 4-16张
|
||||
|
||||
public static IEnumerator coCreateMap(string heightMap, string mixMap, string[] baseMap, Action<UnityEngine.Object[]> action)
|
||||
{
|
||||
List<UnityEngine.Object> result = new List<UnityEngine.Object>();
|
||||
yield return XResLoader.coLoadAllRes(new string[] { heightMap, mixMap }, typeof(GameObject), objs =>
|
||||
{
|
||||
if (objs == null || objs[0] == null)
|
||||
{
|
||||
Debug.Log($"Load heightMap, mixMap Failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(objs[0]);//heightMap
|
||||
result.Add(objs[1]);//mixMap
|
||||
}
|
||||
});
|
||||
yield return XResLoader.coLoadAllRes(baseMap, typeof(GameObject), objs =>
|
||||
{
|
||||
if (objs == null || objs[0] == null)
|
||||
{
|
||||
Debug.Log($"Load heightMap, mixMap Failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < objs.Length; ++i)
|
||||
{
|
||||
result.Add(objs[i]);//baseMap
|
||||
}
|
||||
}
|
||||
});
|
||||
action(result.ToArray());
|
||||
}
|
||||
|
||||
void LoadGround(float xpos, float zpos)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user