Files
MRCS/Assets/_MrCs/Scripts/Data/EnemyInfo.cs
2025-11-04 14:51:46 +08:00

82 lines
1.7 KiB
C#

using static XPlugin.Data.JsonLiteDB.JsonLiteDB;
public enum EnemyType
{
HR01 = 0,
PHR01 = 1,
MR3 = 2,
GRMII = 3,
NXR03 = 4,
BLR02 = 5,
SDRRMI = 6,
DragonBoss = 7,
AirdropBloodPack = 8,
AirdropJoinControl = 9,
}
public class EnemyInfo
{
public int ID;
public int Type;
public string Name;
public string CN_Name;
public int Lvl;
public float Hp;
public float Atk;
public float Speed;
public float Toughness;
public float MinAtkArea;
public float MaxAtkArea;
public TowerType Priority;
public float Radius;
public float Height;
public EnemyInfo(TableReader table)
{
ID = table["ID"].OptInt();
Type = table["Type"].OptInt();
Name = table["Name"].OptString();
CN_Name = table["CN_Name"].OptString();
Lvl = table["Lvl"].OptInt();
Hp = table["Hp"].OptFloat();
Atk = table["Atk"].OptFloat();
Speed = table["Speed"].OptFloat();
Toughness = table["Toughness"].OptFloat();
float[] areas = ParseStringToIntArray(table["AtkArea"].OptString());
MinAtkArea = areas[0];
MaxAtkArea = areas[1];
Priority = (TowerType)table["Priority"].OptInt();
Radius = table["Radius"].OptFloat();
Height = table["Height"].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;
}
}