using System.Collections; using System.Collections.Generic; using System.Xml; using Sfs2X; using UnityEngine; public class Robot { #region Config private static bool Initialized; private static int MinChestValue; private static int MaxChestValue; private static float MinLifetime; private static float MaxLifetime; private static float CreateChestRate; private static float ColorChestRate; private static float DigitChestRate; private static float MinMoveTime; private static float MaxMoveTime; private static float MinRobotCreateTime; private static float MaxRobotCreateTime; private static string MaxRobotAmtFml; private static string ConfigName = "robot_config"; private static string RootNodeName = "data"; private static string DataNodeName = "item"; private float LifetimeTimer; private float MoveTimer; private SmartFox SmartFox; #endregion public static void Initialize() { if (Initialized) { Initialized = true; return; } XmlDocument document = ManaData.GetXmlDocument(ConfigName); XmlNode dataNode = document.SelectSingleNode(RootNodeName).SelectSingleNode(DataNodeName); XmlAttributeCollection attributes = dataNode.Attributes; int index = 1; List ints = Auxiliary.IntListParse(',', attributes[index++].Value, null); MinRobotCreateTime = ints[0]; MaxRobotCreateTime = ints[1]; MaxRobotAmtFml = attributes[index++].Value; DigitChestRate = float.Parse(attributes[index++].Value); ColorChestRate = float.Parse(attributes[index++].Value); ints = Auxiliary.IntListParse(',', attributes[index++].Value, null); MinMoveTime = ints[0]; MaxMoveTime = ints[1]; CreateChestRate = float.Parse(attributes[index++].Value); ints = Auxiliary.IntListParse(',', attributes[index++].Value, null); MinChestValue = ints[0]; MaxChestValue = ints[1]; ints = Auxiliary.IntListParse(',', attributes[index++].Value, null); MinLifetime = ints[0]; MaxLifetime = ints[1]; Debug.Log($"RobotConfig {MinRobotCreateTime}"); Debug.Log($"RobotConfig {MaxRobotCreateTime}"); Debug.Log($"RobotConfig {MaxRobotAmtFml}"); Debug.Log($"RobotConfig {DigitChestRate}"); Debug.Log($"RobotConfig {ColorChestRate}"); Debug.Log($"RobotConfig {MinMoveTime}"); Debug.Log($"RobotConfig {MaxMoveTime}"); Debug.Log($"RobotConfig {CreateChestRate}"); Debug.Log($"RobotConfig {MinChestValue}"); Debug.Log($"RobotConfig {MaxChestValue}"); Debug.Log($"RobotConfig {MinLifetime}"); Debug.Log($"RobotConfig {MaxLifetime}"); } public void Start() { } public void Update() { } }