菜鸡代码,大佬勿喷
矩形的两个对角可以确定矩形大小
如图a,b两点确定一个矩形范围,或者一个空间范围;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AiMove : MonoBehaviour
{
private GameObject End;
private Transform Db3;
bool suo = false;
//时间容器
float time = 0;
//时间范围我这里是随机的,也可以改为动值
int time1;
//v1,v2确定矩形范围
Vector3 v1;
Vector3 v2;
//目标点
Vector3 pos;
// Start is called before the first frame update
void Start()
{
End = PlayGame.Ins.End.gameObject;
Db3 = End.transform.GetChild(End.transform.childCount - 1);
v1 = Db3.GetChild(D