public static void Main(string[] args) { var worker = new FactoryWorker(); var result = worker.AddNumbers(2, 3); Console.WriteLine(result.ToString()); }
public void LoadLevel(ComponentsEnum[,] level) { ClearBoard(); // Clearing the board from previous data m_board = new BasicBoardComponent[level.GetLength(0), level.GetLength(1)]; ForeEachAction((row, col) => m_board[row, col] = m_componentFactory.Create(level[row, col], row, col)); m_worker = FindWorker(); }
public static void Main(string[] args) { var worker = new FactoryWorker(); worker.Count(4); worker.Count(5); worker.Count(4.5f); }
public BoardComponentFactory() { factory = new Dictionary <ComponentsEnum, BoardComponentFactoryMethod>() { { ComponentsEnum.EMPTY_CELL, (row, col) => { return(new Cell(row, col)); } }, { ComponentsEnum.TARGET_CELL, (row, col) => { return(new Cell(row, col, true)); } }, { ComponentsEnum.WALL, (row, col) => { return(new Wall(row, col)); } }, { ComponentsEnum.PACKAGE, (row, col) => { Cell parent = new Cell(row, col); // Creating the cell that will be the parent Package package = new Package(parent); // Creating the package object parent.SetMovableOccupant(package); // Setting that the package is in the cell return(parent); } }, { ComponentsEnum.FACTORY_WORKER, (row, col) => { Cell parent = new Cell(row, col); // Creating the cell that will be the parent FactoryWorker worker = new FactoryWorker(parent); // Creating the worker object parent.SetMovableOccupant(worker); // Setting that the worker is in the cell return(parent); } }, }; }
public string Visit(FactoryWorker component) { return("W"); }
public void AddWorker( FactoryWorker worker ) { workers.Add( worker ); }
public void SetWorker(FactoryWorker worker) { m_currentState.Worker = worker; }
public bool Visit(FactoryWorker component) { NumberOfBoxesPushed = 0; // Set the defualt number of packages pushed return(TryMakeMove(component)); // Trying to make move }
public void Visit(FactoryWorker component) { // Do nothing }
public void ResetFactoryWorker() { m_worker = null; }
public void Visit(FactoryWorker component) { m_worker = component; // Storing the worker }