So I was working on a game that I am making to teach myself how to code, everything was going fine until I compiled, found a room was not linked to the other room and trapping the player in said room, I exited the program and went back to the code and went to make the changes needed, once I finished I hit the start button to ensure the changes worked. Thats when I started getting the error. Here is the code that I am getting the error at, I have not touched this particular piece of code in some time so it confuses me as to why its suddenly throwing an exception, I also have not edited any code related to what this is checking.
If you need more info let me know and I will be happy to provide it. Thank you.
C#:
public bool HasRequiredItemToEnterThisLocation(Location location)
{
if (location.ItemRequiredToEnter == null)
{
// There is no required item for this location, so return "true"
return true;
}
// See if the player has the required item in their inventory
return Inventory.Any(ii => ii.Details.ID == location.ItemRequiredToEnter.ID);
}
If you need more info let me know and I will be happy to provide it. Thank you.