五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

史上最全Unity3D教程

2022-07-05 08:50 作者:屑貓貓耳  | 我要投稿

c#代碼

p140

EnemyMotor

using System.Collections;

using System.Collections.Generic;

using Unity.VisualScripting;

using UnityEngine;

using UnityEngine.SocialPlatforms;

/// <summary>

/// 敵人馬達(dá)器,提供移動(dòng)、旋轉(zhuǎn)、尋路功能

/// </summary>

public class EnemyMotor : MonoBehaviour

{

??private Vector3 startingPoint;

??private Vector3 destination;

??private WayLine wayLine;

??private Vector3[] points;

??private EnemySpawn enemySpawn;

??private bool isMove;

??public float nextTime;

??private int i = 0;

??/// <summary>

??/// 前行

??/// </summary>

??public void MovementForward()

??{

????this.transform.Translate(0, 0, (float)0.02);

??}


??/// <summary>

??/// 注視旋轉(zhuǎn)

??/// </summary>

??/// <param name="targetPoint">需要注視的目標(biāo)點(diǎn)</param>

??public void targetPoint(Vector3 targetPoint)

??{

????this.transform.LookAt(targetPoint);

??}

??/// <summary>

??/// 尋路,沿路線移動(dòng)

??/// </summary>

??/// <returns></returns>

??public bool Pathfinding()

??{

????targetPoint(points[i]);

????MovementForward();

????//你可以試試==0,會(huì)發(fā)生什么

????if (Vector3.Distance(this.transform.position, points[i]) <=0.02)

??????i++;

????if (i >= 4)

??????return false;

????else

??????return true;

??}

??// Start is called before the first frame update

??void Start()

??{

????isMove=true;

????startingPoint = this.transform.position;

????nextTime = 1;

????enemySpawn =Object.FindObjectOfType<EnemySpawn>();

????wayLine = enemySpawn.FingWayLine();

????points = wayLine.GetWayPoints();

??}


??// Update is called once per frame

??void Update()

??{

????if (isMove)

????{

??????isMove = Pathfinding();

????}

??}

}


using System;

using System.Collections;

using System.Collections.Generic;

using System.Drawing;

using System.Reflection;

using UnityEngine;

/// <summary>

/// 敵人生成器

/// </summary>

public class EnemySpawn : MonoBehaviour

{

??private WayLine[] wayLines;

??private System.Random random;

??private int firstNum;

??private int finallyNum;

??public int nextTime;

??// Start is called before the first frame update

??//private Vector3 point;

??//private Vector3[] points;

??//private WayLine wayLine;

??void Start()

??{

????//wayLine=FingWayLine();

????//points = wayLine.Points;

????//for (int i = 0; i < points.Length; i++)

????//{

????//point = points[i];

????//Debug.Log(point);

????//}

??}

??/// <summary>

??/// 找路線,沒(méi)做不重復(fù)

??/// </summary>

??public WayLine FingWayLine()

??{

????wayLines = this.transform.GetComponentsInChildren<WayLine>();

????random = new System.Random();

????firstNum = 0;

????finallyNum = wayLines.Length;

????int usedNum = random.Next(firstNum, finallyNum);

????wayLines[usedNum].IsUseable = false;

????Debug.Log(wayLines[usedNum]);

????//if (usedNum == firstNum)

??????//firstNum += 1;

????//else if (usedNum == finallyNum)

??????//finallyNum -= 1;

????return wayLines[usedNum];

??}

}


using System;

using System.Collections;

using System.Collections.Generic;

using System.Drawing;

using UnityEngine;

/// <summary>

/// 路線類

/// </summary>

public class WayLine : MonoBehaviour

{

??private Vector3[] Points;

??public bool IsUseable;

??private Transform[] PointsTF;

??private Vector3[] newPoints;

??// Start is called before the first frame update

??void Start()

??{

????PointsTF = this.transform.GetComponentsInChildren<Transform>();

????Points = new Vector3[PointsTF.Length];

????newPoints = new Vector3[PointsTF.Length - 1];

????IsUseable=true;

??}

??/// <summary>

??/// 找路點(diǎn)

??/// </summary>

??/// <returns>Vector3[] 路點(diǎn)數(shù)組</returns>

??public Vector3[] GetWayPoints()

??{

????for (int i = 0; i < PointsTF.Length; i++)

????{

??????Points[i] = PointsTF[i].position;??

????}

????for (int i = 0; i < newPoints.Length; i++)

????{

??????newPoints[i] = Points[i + 1];

????}

????return newPoints;

??}



敵人可以用Cube代替


史上最全Unity3D教程的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
辽源市| 阳城县| 玛纳斯县| 万荣县| 安化县| 左权县| 灵武市| 顺昌县| 浦北县| 日土县| 和龙市| 靖江市| 阳山县| 广汉市| 固阳县| 阿克陶县| 什邡市| 宽城| 宜城市| 肥乡县| 壤塘县| 敦化市| 巨野县| 温宿县| 明光市| 陇川县| 东宁县| 额济纳旗| 隆昌县| 阳曲县| 潢川县| 商南县| 义乌市| 简阳市| 长寿区| 中阳县| 连城县| 都安| 五台县| 苗栗县| 古交市|