using System.Collections; using System.Collections.Generic; using UnityEngine; public class otherWoniu : MonoBehaviour { public List EndPosList; public Transform WaitingArea;//等待区域 public List bossContros; public Transform OrPosTrams;//出发点 public Transform Panrent;//父亲节点 // Start is called before the first frame update void Start() { //OtherWoniuMove(); } public void OtherWoniuMove() { int Index = Random.Range(0, EndPosList.Count); transform.GetComponent().EndPos = EndPosList[Index].transform; transform.GetComponent().StartMove(); } public void BackWait() { // 需要时将 childObject 移回原始父物体,并设置为第一个子节点 transform.SetParent(Panrent); Vector3 RePos = Panrent.position; RePos = new Vector2(RePos.x + Random.Range(-300, 300), RePos.y + Random.Range(-80, 80)); transform.position = RePos; transform.GetComponent().StartPos = OrPosTrams; //transform.position =new Vector2 (Random.Range(-50,50), Random.Range(-50, 50)); } }