46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class otherWoniu : MonoBehaviour
|
|
{
|
|
public List<GameObject> EndPosList;
|
|
public Transform WaitingArea;//等待区域
|
|
public List<BossContro> 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<PlayerMove>().EndPos = EndPosList[Index].transform;
|
|
transform.GetComponent<PlayerMove>().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<PlayerMovePos>().StartPos = OrPosTrams;
|
|
|
|
//transform.position =new Vector2 (Random.Range(-50,50), Random.Range(-50, 50));
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|