public void ExecuteAction(GameObject dataObject) { if (userInterface.CheckIfHasResources(checkFor, amountNeeded)) { //consume the resource and update the UI userInterface.ConsumeResource(checkFor, amountNeeded); ExecuteAllActions(dataObject); } }
public override bool ExecuteAction(GameObject dataObject) { bool hasEnoughResource = userInterface.CheckIfHasResources(checkFor, amountNeeded); if(hasEnoughResource) { //consume the resource and update the UI userInterface.ConsumeResource(checkFor, amountNeeded); } return hasEnoughResource; }
public override bool ExecuteAction(GameObject dataObject) { if (userInterface != null) { bool hasEnoughResource = userInterface.CheckIfHasResources(checkFor, amountNeeded); if (hasEnoughResource) { //consume the resource and update the UI userInterface.ConsumeResource(checkFor, amountNeeded); } return(hasEnoughResource); } else { Debug.LogWarning("User Interface prefab has not been found in the scene. The action can't execute!"); return(false); } }