public static SaveGameCore AddResource(this SaveGameCore input, ResourceType resourceType, int count = 1) { SaveGameCore saveGame = input; int currentId = saveGame.IdGenerator.NextId.Value; for (int i = 0; i < count; i++) { ResourceCore resource = new ResourceCore() { Condition = new ValueAttribute<double>() { Value = 1 }, Durability = new ValueAttribute<double>() { Value = 1 }, Id = new ValueAttribute<int>() { Value = currentId }, Location = new ValueAttribute<int>() { Value = 1 }, Orientation = new CoordinatesCore() { X = 0, Y = 0, Z = 0 }, Position = new CoordinatesCore() { X = 0, Y = 0, Z = 0 }, State = new ValueAttribute<int>() { Value = 1 }, Traderid = new ValueAttribute<int>() { Value = -1 }, Subtype = new ValueAttribute<int>() { Value = 0 }, Type = resourceType }; currentId++; saveGame.Resources.Resource.Add(resource); } saveGame.IdGenerator.NextId.Value = currentId; return saveGame; }
//locate and cache a pointer to the resource manager void updateReferences() { overlord = GameObject.FindGameObjectWithTag("master").GetComponent <Overlord>(); resCore = overlord.resourceCore; itemMagr = overlord.resourceCore.itemSlice; resMgr = resCore.resourceSlice; pls = overlord.requestPlayerList(); }
private void InitializeObject() { resourceCore = new ResourceCore(); mqttClient = new MQTTClient(); cctvTimer = new DispatcherTimer(); cctvTimer.Tick += CctvTimer_Tick; cctvTimer.Interval = new TimeSpan(0, 0, 10); }
private void InitializeObject() { resourceCore = new ResourceCore(); environmentCore = new EnvironmentCore(); mqttClient = new MQTTClient(); serial = new Serial(9600); weatherResetTimer = new DispatcherTimer(); weatherResetTimer.Tick += WeatherResetTimer_Tick; weatherResetTimer.Interval = new TimeSpan(0, 30, 0); cctvTimer = new DispatcherTimer(); cctvTimer.Tick += CctvTimer_Tick; cctvTimer.Interval = new TimeSpan(0, 0, 10); }
[SerializeField] Color fadeToColor; //color to fade or lerp to //----------------------------------------------------------------------------------------------------------------------------- void Start() { fullResistance = 0; renderer = this.GetComponent <Renderer>(); //get a reference to the renderer myColor = renderer.material.GetColor("_EmissionColor"); //grab the emission color from the renderer //locate and cache important object pointers try { overlord = GameObject.FindGameObjectWithTag("master").GetComponent <Overlord>(); resCore = overlord.resourceCore; resMgr = resCore.resourceSlice; pls = overlord.requestPlayerList(); active = true; } catch (System.Exception e) { //failed to find an overlord in the scene, sp we'll deactivate this tile's logic. //this will happen on the menu scene every time e.ToString(); active = false; } }