|
@@ -18,6 +18,7 @@ namespace ET.Client
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private static CommonLang.Geometry.Vector3 vecTemp = new();
|
|
|
private async ETTask CreatUnitModel(BattleUnit unit)
|
|
|
{
|
|
|
var zu = unit.ZUnit;
|
|
@@ -25,21 +26,19 @@ namespace ET.Client
|
|
|
var handle = await YooAssetProxy.LoadAssetAsync<GameObject>($"Unit_{zu.Info.FileName}");
|
|
|
var prefab = handle.GetAssetObject<GameObject>();
|
|
|
GameObject go = UnityEngine.Object.Instantiate(prefab, GlobalViewComponent.Instance.Unit, true);
|
|
|
- go.transform.position = new Vector3(0, 0, 0);
|
|
|
- go.transform.rotation = Quaternion.identity;
|
|
|
+ vecTemp.Set(unit.ZUnit.X, unit.ZUnit.Y, unit.ZUnit.Z);
|
|
|
+ go.transform.position = RenderUtils.UnityPosFromBattle(vecTemp);
|
|
|
+ go.transform.rotation = RenderUtils.UnityRotationFromBattle(zu.Direction);
|
|
|
|
|
|
- ModelViewComponent.Instance.AddChildWithId<AnimatorComponent, GameObject>(unit.Id, go, true);
|
|
|
+ ModelViewComponent.Instance.AddChildWithId<UnitRenderComponet, GameObject>(unit.Id, go, true);
|
|
|
|
|
|
if (unit is BattleActor)
|
|
|
{
|
|
|
- //相机跟随主角
|
|
|
- //ModelViewComponent.Instance.AddComponent<CameraComponent>().Unit = unit;
|
|
|
-
|
|
|
- //固定视角相机
|
|
|
- var camera = Camera.main;
|
|
|
- var pos = go.transform.position;
|
|
|
- camera.transform.position = new Vector3(pos.x, 7, pos.z - 15);
|
|
|
+ CameraMgr.FollowMe(go.transform.position);
|
|
|
}
|
|
|
+ Log.Debug($"unitRender({zu.ObjectID}) ok.");
|
|
|
+
|
|
|
+ //TODO: 同步ZoneUnit status
|
|
|
}
|
|
|
}
|
|
|
}
|