51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using UnityEngine;
|
|
using static XPlugin.Data.JsonLiteDB.JsonLiteDB;
|
|
|
|
public class CombatUnitInfo
|
|
{
|
|
public int ID;
|
|
/// <summary>
|
|
/// 所属波次
|
|
/// </summary>
|
|
public int Belong;
|
|
public int EnemyType;
|
|
|
|
public int Special;
|
|
/// <summary>
|
|
/// 出生位置
|
|
/// </summary>
|
|
public Vector3 BornPos;
|
|
/// <summary>
|
|
/// 出生角度
|
|
/// </summary>
|
|
public float BornAngleY;
|
|
public float BornTime;
|
|
|
|
public CombatUnitInfo(TableReader table)
|
|
{
|
|
ID = table["ID"].OptInt();
|
|
Belong = table["Belong"].OptInt();
|
|
EnemyType = table["EnemyType"].OptInt();
|
|
Special = table["Special"].OptInt();
|
|
float[] pos = ParseStringToIntArray(table["BornPos"].OptString());
|
|
BornPos = new Vector3(pos[0], pos[1], pos[2]);
|
|
BornAngleY = table["BornAngleY"].OptFloat();
|
|
BornTime = table["BornTime"].OptFloat();
|
|
}
|
|
|
|
float[] ParseStringToIntArray(string input)
|
|
{
|
|
if (input == "")
|
|
{
|
|
return null;
|
|
}
|
|
string[] elements = input.Replace("(", "").Replace(")", "").Split(',');
|
|
float[] intArray = new float[elements.Length];
|
|
|
|
for (int i = 0; i < elements.Length; i++)
|
|
{
|
|
intArray[i] = float.Parse(elements[i]);
|
|
}
|
|
return intArray;
|
|
}
|
|
} |