54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class otherWoniu : MonoBehaviour
|
|
{
|
|
|
|
|
|
|
|
public Transform OrPosTrams;//出发点
|
|
public Transform Panrent;//父亲节点
|
|
//public AllHouseContro allHouseContros;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
//OtherWoniuMove();
|
|
//allHouseContros=GameObject.Find("Canvas/Bg").GetComponent<AllHouseContro>();
|
|
}
|
|
|
|
public void OtherWoniuMove(HouseBtn house)
|
|
{
|
|
|
|
|
|
transform.GetComponent<OtherMove>().EndPos=house.post.transform;
|
|
transform.GetComponent<OtherMove>().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));
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|