// Update is called once per frame void Update() { lastWorldState.Clear(); lastWorldState.UnionWith(worldState); //Clear world state worldState.Clear(); //Update world state List <I_EnvironmentNode> pois = EnvironmentQueryManager.GetInstance().QueryNodesOfType <Field>().GetNodes(); for (int i = 0; i < pois.Count; i++) { Field f = (Field)pois[i]; if (f.m_FieldState == Field.STATE.PLANTING) { worldState.Add("Planting"); } else if (f.m_FieldState == Field.STATE.HARVESTING) { worldState.Add("Harvesting"); } else if (f.m_FieldState == Field.STATE.GROWING) { //worldState.Add("Growing"); } } /*int resourcePickups = EnvironmentQueryManager.GetInstance().QueryNodesOfType<ResourcePickup>().Count(); * if (resourcePickups > 0) * { * worldState.Add("Pickup"); * }*/ //i need to rewrite this foreach (List <GoapObject> objects in goapObjects.Values) { foreach (GoapObject goapObject in objects) { foreach (GoapEffect effect in goapObject.GetWorldEffects()) { worldState.Add(GoapEffect.IdNames[effect.value]); } } } if (!lastWorldState.SetEquals(worldState)) { OnWorldStateChanged?.Invoke(worldState); #if UNITY_EDITOR UpdateDebugList(); #endif } }