35 lines
950 B
C#
35 lines
950 B
C#
using UnityEngine;
|
|
using static XPlugin.Data.JsonLiteDB.JsonLiteDB;
|
|
|
|
public class ScenesInfo
|
|
{
|
|
public int ID;
|
|
public BuildType TowerType;
|
|
public Vector3 BornPos;
|
|
public float BornAngleY;
|
|
|
|
public ScenesInfo(TableReader table)
|
|
{
|
|
ID = table["ID"].OptInt();
|
|
TowerType = (BuildType)table["BuildType"].OptInt();
|
|
float[] pos = ParseStringToIntArray(table["BornPos"].OptString());
|
|
BornPos = new Vector3(pos[0], pos[1], pos[2]);
|
|
BornAngleY = table["BornAngleY"].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;
|
|
}
|
|
} |