Cute_demon_attacks/meng_yao/Assets/script/A_Fight/InitEnenyData.cs
wulongxiao 9bd1be8b9b 修改
2025-01-06 12:06:49 +08:00

37 lines
916 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.GlobalIllumination;
public class InitEnenyData : MonoBehaviour
{
public static InitEnenyData instance;
[Header("路径点集合")] public List<waypoints> mywaypoints = new List<waypoints>();
private void Awake()
{
instance = this;
// Debug.Log(mywaypoints.Count);
}
// 返回一个随机选择的路径点集合
public waypoints GetRandomWaypoints(int index)
{
// 检查列表是否为空,避免数组越界错误
if (mywaypoints.Count == 0)
{
Debug.LogError("路径点集合为空!");
return null; // 或者返回一个默认值
}
// 如果只有一个路径点集合,直接返回
if (mywaypoints.Count == 1)
{
return mywaypoints[0];
}
// 返回随机选择的路径点集合
return mywaypoints[index];
}
}