在生成点生成带有颜色的小球,小球走对应颜色的路

先做好三个小球,做成预制体

对应颜色的小球,除了自身颜色,其他颜色不要选

新建脚本:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI; public class xunlu002 : MonoBehaviour {
public float time = ;
public Transform target;
public Transform tr;//生成点
public GameObject[] obj = new GameObject[];
private NavMeshAgent agent;
GameObject go;
List<GameObject> c = new List<GameObject>(); // Use this for initialization
void Start () { } // Update is called once per frame
void Update () {
time += Time.deltaTime;
if (time > )
{ go = Instantiate(obj[Random.Range(, obj.Length)], tr.position, Quaternion.identity);
go.GetComponent<NavMeshAgent>().destination = GameObject.Find("target").transform.position; c.Add(go);
time = ; }
foreach (GameObject item in c)
{
if (Vector3.Distance( item.transform.position, target.position) <= 1.1f)
{
Destroy(item,);
c.Remove(item);
} }
} }

AI案列 三条路的更多相关文章

  1. vue父子间通信案列三($emit和prop用法)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. SpringCloud断路器(Hystrix)和服务降级案列

    断路器(Hystrix) 为什么需要 Hystrix? 在微服务架构中,我们将业务拆分成一个个的服务,服务与服务之间可以相互调用(RPC).为了保证其高可用,单个服务又必须集群部署.由于网络原因或者自 ...

  3. pyinstaller和wordcloud和jieba的使用案列

    一.pyinstaller库 1.简介 pyinstaller库:将脚本程序转变为可执行(.exe)格式的第三方库 注意:需要在.py文件所在目录进行以下命令,图标扩展名是.ico 2.格式: pyi ...

  4. Spring MVC的配置文件(XML)的几个经典案列

    1.既然是配置文件版的,那配置文件自然是必不可少,且应该会很复杂,那我们就以一个一个的来慢慢分析这些个经典案列吧! 01.实现Controller /* * 控制器 */ public class M ...

  5. SAMSUNG某型号一千短信成功记录!对比其他软件恢复不成功的案列!

    Hello! 大家好欢迎再次来到Dr.wonde的博客, 下面谈一下今天的案列,今年11月26号收到了一客户寄来的三星S4手机恢复里面短信, 如下图所示,用其他软件恢复以后,数据为零,没有恢复,,这下 ...

  6. axis1,xfire,jUnit 测试案列+开Web Service开发指南+axis1.jar下载 代码

    axis1,xfire,jUnit 测试案列+Web Service开发指南(中).pdf+axis1.jar下载    代码 项目和资源文档+jar 下载:http://download.csdn. ...

  7. 洗礼灵魂,修炼python(4)--从简单案列中揭示常用内置函数以及数据类型

    上一篇说到print语句,print是可以打印任何类型到屏幕上,都有哪些类型呢? 整形(int) 长整型(long) 浮点型(float) 字符型(str) 布尔型(bool) 最常见的就这几种. 在 ...

  8. 大数据技术之_14_Oozie学习_Oozie 的简介+Oozie 的功能模块介绍+Oozie 的部署+Oozie 的使用案列

    第1章 Oozie 的简介第2章 Oozie 的功能模块介绍2.1 模块2.2 常用节点第3章 Oozie 的部署3.1 部署 Hadoop(CDH版本的)3.1.1 解压缩 CDH 版本的 hado ...

  9. [项目实施失败讨论Case] “凭心而论,在这家公司很敬业的工作了3年多,老板最后给我下的评语,大家都看看吧,千万别和我走同一条路!”(摘自csdn)

    [Case] “凭心而论,在这家公司很敬业的工作了3年多,老板最后给我下的评语,大家都看看吧,千万别和我走同一条路!”(摘自csdn) 原文:http://community.csdn.net/Exp ...

随机推荐

  1. 使用FFmpeg常见问题

    使用FFmpeg常见问题 https://blog.csdn.net/willib/article/details/52530328 https://blog.csdn.net/nogodoss/ar ...

  2. C语言中gets(), scanf()区别

    C语言中gets(), scanf()区别 相同点: gets()和 scanf() 1.函数都可用于输入字符串 2.都在stdio.h头文件中定义. 3.字符串接受字符结束后自动加'\0' 不同点: ...

  3. linux学习:【第2篇】常用命令

    狂神声明 : 文章均为自己的学习笔记 , 转载一定注明出处 ; 编辑不易 , 防君子不防小人~共勉 ! linux学习:[第2篇]常用命令 基本命令 //打开终端: CentOS:在任何地方,右键-- ...

  4. 转:Java中Scanner类和BufferReader类之间的区别

    原文地址:https://blog.csdn.net/u014717036/article/details/52227782 java.util.Scanner类是一个简单的文本扫描类,它可以解析基本 ...

  5. LeetCode 485 Max Consecutive Ones 解题报告

    题目要求 Given a binary array, find the maximum number of consecutive 1s in this array. 题目分析及思路 给定一个01数组 ...

  6. LeetCode 867 Transpose Matrix 解题报告

    题目要求 Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped ov ...

  7. LeetCode 973 K Closest Points to Origin 解题报告

    题目要求 We have a list of points on the plane.  Find the K closest points to the origin (0, 0). (Here, ...

  8. LeetCode 657 Robot Return to Origin 解题报告

    题目要求 There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of it ...

  9. django--admin组件

    一,激活管理工具(一般建立工程已创建) 1,setting.py 中安装子应用 INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.a ...

  10. nginx最基本操作

    1.安装 yum install nginx 2.查看配置位置 nginx -t 3.查看nginx.conf,找到默认html配置路径 vi /etc/nginx/nginx.conf cd /us ...