public static ResourceQueue create(string a_tag, string a_modState, Dictionary <string, WorldState> a_worldStates, GameObject[] gameObjectsInQueue) { ResourceQueue newResourceQueue = new ResourceQueue(); newResourceQueue.tag = a_tag; newResourceQueue.modState = a_modState; //if (tag != "") // { //GameObject[] resources = World.Instance.FindAllGameObjectsWithTag(tag); foreach (GameObject r in gameObjectsInQueue) { newResourceQueue.gameObjectsWithTag.Add(r); } if (newResourceQueue.modState != "") { if (a_worldStates.TryGetValue(newResourceQueue.modState, out WorldState value)) { value.ModifyState(newResourceQueue.gameObjectsWithTag.Count); } // a_worldStates[newResourceQueue.modState].ModifyState(newResourceQueue.queue.Count); } //} return(newResourceQueue); }
//Helper function to add resource to a queue and dictionary public void AddResourceQueue(string tag, string stateName, WorldStates worldStates) { if (resourcesDictionary.ContainsKey(stateName)) { Debug.Log(stateName + " already exists"); return; } Queue = new ResourceQueue(tag, stateName, worldStates); resourcesDictionary.Add(stateName, Queue); }