2024-12-09 23:24:46 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Experimental.GlobalIllumination;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class InitEnenyData : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public static InitEnenyData instance;
|
|
|
|
|
[Header("·<><C2B7><EFBFBD>㼯<EFBFBD><E3BCAF>")] public List<waypoints> mywaypoints = new List<waypoints>();
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
|
|
|
|
instance = this;
|
2024-12-12 23:04:13 +08:00
|
|
|
|
// Debug.Log(mywaypoints.Count);
|
2024-12-09 23:24:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>㼯<EFBFBD><E3BCAF>
|
|
|
|
|
public waypoints GetRandomWaypoints()
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1>Ƿ<EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (mywaypoints.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogError("·<><C2B7><EFBFBD>㼯<EFBFBD><E3BCAF>Ϊ<EFBFBD>գ<EFBFBD>");
|
|
|
|
|
return null; // <20><><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>һ<EFBFBD><D2BB>Ĭ<EFBFBD><C4AC>ֵ
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>һ<EFBFBD><D2BB>·<EFBFBD><C2B7><EFBFBD>㼯<EFBFBD>ϣ<EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>
|
|
|
|
|
if (mywaypoints.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
return mywaypoints[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7> [0, mywaypoints.Count - 1]
|
|
|
|
|
int randomIndex = Random.Range(0, mywaypoints.Count);
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>㼯<EFBFBD><E3BCAF>
|
|
|
|
|
return mywaypoints[randomIndex];
|
|
|
|
|
}
|
|
|
|
|
}
|