private bool DoSelfActions() { // Don't do anything if there's nothing to do. if (selfAction != null) { Blackboard state = new Blackboard() { { "Actor", Actor }, { "Cell", OriginCell } }; selfAction.Do(state); } // Also assumes success if there was nothing to do. return(true); }
private void DoTargetedActions() { // Only do things if there ARE targeted actions to perform. if (targetedAction != null) { // Apply actions to each affected cell. foreach (Cell cell in affectedCells) { Blackboard state = new Blackboard() { { "Actor", Actor }, { "Cell", cell } }; // If the action tree fails on a cell, do we // cancel further action on other cells? bool success = targetedAction.Do(state); if (!AffectedCellsIndependent && !success) { break; } } } }