load deviceANDIcon by codes automatically

This commit is contained in:
XuGaoFeng
2026-07-10 15:01:12 +08:00
parent 9579356ed1
commit d5aeb63276
17 changed files with 4670 additions and 4172 deletions

View File

@@ -9,16 +9,16 @@ public class FastSlowAnimationANDZoomIN : MonoBehaviour
public Camera workerCamera;
//Animator anim;
public float maxHeight = 2f; // 最大上升高度(米)
float scaleRation = 0.5f;//默认缩放系数
public float upTime = 1.5f;// 上升到最高点所需时间(秒)
public float maxHeight = 2f; // 最大上升高度(米)
float scaleRation = 0.5f;//默认缩放系数
public float upTime = 1.5f;// 上升到最高点所需时间(秒)
private Dictionary<Transform, Vector3> childrenStartPos = new Dictionary<Transform, Vector3>();
// Start is called before the first frame update
void Start()
{
cam = Camera.main;
// workerCamera = GameObject.Find("WorkerCamera").GetComponent<Camera>();zhe行代码为什么会引起 bug目前还不清楚
// workerCamera = GameObject.Find("WorkerCamera").GetComponent<Camera>();zhe行代码为什么会引起 bug目前还不清楚
foreach (Transform child in transform)
{
@@ -28,14 +28,14 @@ public class FastSlowAnimationANDZoomIN : MonoBehaviour
}
// Update is called once per frame
void Update()
void LateUpdate()
{
if (cam.gameObject.activeInHierarchy == true)
{
//自由视角下的动画逻辑
foreach (Transform child in transform)//每个孩子就是一个世界空间的大画布
//自由视角下的动画逻辑
foreach (Transform child in transform)//每个孩子就是一个世界空间的大画布
{
//通过遍历每个子物体,每个物体的大小是独立计算的,不能取最小值
//通过遍历每个子物体,每个物体的大小是独立计算的,不能取最小值
float dist = Vector3.Distance(child.position, cam.transform.position);
float scale = scaleRation * dist / 30f;
scale = Mathf.Clamp(scale, 0.0333f, 10f);
@@ -47,14 +47,14 @@ public class FastSlowAnimationANDZoomIN : MonoBehaviour
child.position = childrenStartPos[child] + new Vector3(0, yOffset, 0);
child.localScale = Vector3.one * scale;
child.LookAt(child.position + cam.transform.forward);//看相机
child.LookAt(child.position + cam.transform.forward);//看相机
//transform.LookAt(transform.position + target.forward);
}
}
else
{
//切换到工人视角下所放和浮动在这里
foreach (Transform child in transform)//每个孩子就是一个世界空间的大画布
//切换到工人视角下所放和浮动在这里
foreach (Transform child in transform)//每个孩子就是一个世界空间的大画布
{
@@ -62,7 +62,7 @@ public class FastSlowAnimationANDZoomIN : MonoBehaviour
child.position = childrenStartPos[child] + new Vector3(0, yOffset, 0);
child.localScale = Vector3.one * 0.3f;
child.LookAt(child.position + workerCamera.transform.forward);//看相机
child.LookAt(child.position + workerCamera.transform.forward);//看相机
//transform.LookAt(transform.position + target.forward);
}
}