public void loadXML(bool l_default) { try { if (File.Exists(Location + "PhysicsMeteroid-Settings.xml") && !l_default) { XmlSerializer x = new XmlSerializer(typeof(PhysicsMeteroidSettings)); TextReader reader = new StreamReader(Location + "PhysicsMeteroid-Settings.xml"); PhysicsMeteroidSettings obj = (PhysicsMeteroidSettings)x.Deserialize(reader); settings = obj; reader.Close(); return; } } catch (Exception ex) { LogManager.APILog.WriteLineAndConsole("Could not load configuration: " + ex.ToString()); } try { if (File.Exists(DefaultLocation + "PhysicsMeteroid-Settings.xml")) { XmlSerializer x = new XmlSerializer(typeof(PhysicsMeteroidSettings)); TextReader reader = new StreamReader(DefaultLocation + "PhysicsMeteroid-Settings.xml"); PhysicsMeteroidSettings obj = (PhysicsMeteroidSettings)x.Deserialize(reader); settings = obj; reader.Close(); } } catch (Exception ex) { LogManager.APILog.WriteLineAndConsole("Could not load configuration: " + ex.ToString()); } }
public override void Init() { settings = new PhysicsMeteroidSettings(); m_running = false; m_control = false; m_gen = new Random(3425325);//temp hash settings.maxVelocityFctr = 1F; settings.velocityFctr = 3F; settings.ore_amt = 60000; settings.maxMeteoroidAmt = 10; settings.minMeteoroidAmt = 1; settings.spawnDistance = 3000; settings.spawnAcc = 0.2F; settings.meteorOn = true; Console.WriteLine("PhysicsMeteoroidPlugin '" + Id.ToString() + "' initialized!"); loadXML(); meteorcheck = new Thread(meteorScanLoop); meteorcheck.Start(); controlloop = new Thread(meteorControlLoop); controlloop.Start(); }