unityunity3d配置要求怎么由personnal改为spe

请问如何设置怪物自动巡逻?_unity3d吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:61,296贴子:
请问如何设置怪物自动巡逻?收藏
unity3d,学习专业的游戏引擎-unity3d.达内游戏主程培训,一般要4-16周,就可掌握.变高端游戏达人-薪资翻番.unity3d费用根据培训课时定,上海官方咨询-unity3d.
需要的效果是一个对象在一定的范围内随机移动,但是到了界面边缘不会出去。
学过c#但不是很会,unity的c#没接触过
用自动寻路呗
写个状态机,随机移动,没了
写个初速度,到某个点 x,y,z取反,改变自身方向就好了,速度不变地
最后查了很多资料,有这么一段代码,没有报错,但是运行起来就看不见物体了。不太清楚是什么原因。using UnityEusing System.Cpublic class AI : MonoBehaviour { float spe_x,spe_y,spe_z;//速度 //最大最小移动界限 float maxx=60; float maxy=60; float minx=-60; float miny=-60; float timecounter1; float timexounter2; // Use this for initialization void Start () {
Change (); }
// Update is called once per frame void Update () {
timecounter1 += Time.deltaT
if (timecounter1 & movetime) {
transform.Translate (spe_x, spe_y, 0, Space.Self);
timexounter2 += Time.deltaT
if (timexounter2 & stoptime)
Change ();
timecounter1 = 0;
timexounter2 = 0;
Check (); } void Change() {
stoptime = Random.Range (1, 5);
movetime = Random.Range (1, 20);
spe_x = Random.Range (1, 10);
spe_y = Random.Range (1, 10); } void Check() {
if (transform.localPosition.x & maxx)
spe_x = -spe_x;
transform.localPosition = new Vector3 (maxx, transform.localPosition.y, 0);
if (transform.localPosition.x & minx)
spe_x = -spe_x;
transform.localPosition = new Vector3 (minx, transform.localPosition.y, 0);
if (transform.localPosition.y & maxy)
spe_y = -spe_y;
transform.localPosition = new Vector3 (transform.localPosition.x,maxy, 0);
if (transform.localPosition.y & miny)
spe_y = -spe_y;
transform.localPosition = new Vector3 (transform.localPosition.y,miny, 0);
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或

我要回帖

更多关于 unity 配置文件 的文章

 

随机推荐