You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
982 B
39 lines
982 B
2 months ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class GetAreaTargetManager : MonoBehaviour
|
||
|
{
|
||
|
public Vector3 cameraInitPos = new Vector3();//相机Target初始位置
|
||
|
public float initDis;//相机离Target距离的初始值
|
||
|
public float init_X;//相机水平旋转初始值
|
||
|
public float init_Y;//相机竖直旋转初始值
|
||
|
|
||
|
public static GetAreaTargetManager Instance;
|
||
|
[SerializeField]
|
||
|
private List<Transform> children;
|
||
|
private void Awake()
|
||
|
{
|
||
|
children = new List<Transform>();
|
||
|
foreach (Transform item in transform)
|
||
|
{
|
||
|
children.Add(item);
|
||
|
}
|
||
|
Instance = this;
|
||
|
}
|
||
|
public Transform GetTarget(string name)
|
||
|
{
|
||
|
Transform result = null;
|
||
|
foreach (var item in children)
|
||
|
{
|
||
|
if (item.name == name)
|
||
|
{
|
||
|
result = item;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return result;
|
||
|
}
|
||
|
}
|