goap icon indicating copy to clipboard operation
goap copied to clipboard

populateState comparing whole KVPs instead of just keys?

Open i-make-robots opened this issue 3 years ago • 0 comments

https://github.com/sploreg/goap/blob/d1cea0728fb4733266affea8049da1e373d618f7/Assets/Standard%20Assets/Scripts/AI/GOAP/GoapPlanner.cs#L160

// if the key exists in the current state, update the Value
bool exists = false;

foreach (KeyValuePair<string,object> s in state) {
	if (s.Equals(change)) {  // <-- problem?
		exists = true;
		break;
	}
}

am I missing something? This appears to be comparing whole KVPs, not just the keys.

if (s.Key.Equals(change.Key)) {

appears to work.

i-make-robots avatar Jun 06 '22 17:06 i-make-robots