public bool notifyWhenStorageBuildingChange(Dictionary <string, int> listOfItems) { // IF CHANGING FROM SOMETHING TO NULL if (closestStorageBuilding != null && townAlliegence.getClosestStorageBuildingWithListOfItems(this.transform.position, listOfItems) == null) { //Debug.Log("closest storage building went from something to null"); closestStorageBuilding = null; return(true); } // IF CHANGING FROM NULL TO SOMETHING if (townAlliegence) { if (closestStorageBuilding == null && townAlliegence.getClosestStorageBuildingWithListOfItems(this.transform.position, listOfItems) != null) { //Debug.Log("closest storage building went from null to something"); closestStorageBuilding = townAlliegence.getClosestStorageBuildingWithListOfItems(this.transform.position, listOfItems); return(true); } } // IF CHANGE TO NEW BUILDING if (closestStorageBuilding && townAlliegence.getClosestStorageBuildingWithListOfItems(this.transform.position, listOfItems)) { if (!closestStorageBuilding.Equals(townAlliegence.getClosestStorageBuildingWithListOfItems(this.transform.position, listOfItems))) { //Debug.Log("Closest storage building changed from something to other"); closestStorageBuilding = townAlliegence.getClosestStorageBuildingWithListOfItems(this.transform.position, listOfItems); return(true); } } return(false); }
public bool notifyWhenStorageBuildingWithFreeSpaceChange(string itemName, int amount) { // IF CHANGING FROM SOMETHING TO NULL if (closestStorageBuildingWithFreeSpace != null && townAlliegence.getClosestStoragetBuildingWithFreeSpace(this.transform.position, itemName, amount) == null) { //Debug.Log("closest storage building with freespace went from something to null"); closestStorageBuildingWithFreeSpace = null; return(true); } // IF CHANGING FROM NULL TO SOMETHING if (townAlliegence) { if (closestStorageBuildingWithFreeSpace == null && townAlliegence.getClosestStoragetBuildingWithFreeSpace(this.transform.position, itemName, amount) != null) { //Debug.Log("closest storage building with freespace went from null to something"); closestStorageBuildingWithFreeSpace = townAlliegence.getClosestStoragetBuildingWithFreeSpace(this.transform.position, itemName, amount); return(true); } } // IF CHANGE TO NEW BUILDING if (closestStorageBuildingWithFreeSpace && townAlliegence.getClosestStoragetBuildingWithFreeSpace(this.transform.position, itemName, amount)) { if (!closestStorageBuildingWithFreeSpace.Equals(townAlliegence.getClosestStoragetBuildingWithFreeSpace(this.transform.position, itemName, amount))) { //Debug.Log("Closest storage building with freespace changed from something to other"); closestStorageBuildingWithFreeSpace = townAlliegence.getClosestStoragetBuildingWithFreeSpace(this.transform.position, itemName, amount); return(true); } } return(false); }
public bool notifyWhenWorkReached() { if (buildingInsideOf) { if (buildingInsideOf.Equals(work.getBuildingName())) { return(true); } } return(false); }