예제 #1
0
    public static void Main(string[] args)
    {
        var worker = new FactoryWorker();
        var result = worker.AddNumbers(2, 3);

        Console.WriteLine(result.ToString());
    }
예제 #2
0
 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();
 }
예제 #3
0
    public static void Main(string[] args)
    {
        var worker = new FactoryWorker();

        worker.Count(4);
        worker.Count(5);

        worker.Count(4.5f);
    }
예제 #4
0
 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);
           } },
     };
 }
예제 #5
0
 public string Visit(FactoryWorker component)
 {
     return("W");
 }
 public void AddWorker( FactoryWorker worker ) {
    workers.Add( worker );
 }
예제 #7
0
 public void SetWorker(FactoryWorker worker)
 {
     m_currentState.Worker = worker;
 }
예제 #8
0
 public bool Visit(FactoryWorker component)
 {
     NumberOfBoxesPushed = 0;            // Set the defualt number of packages pushed
     return(TryMakeMove(component));     // Trying to make move
 }
예제 #9
0
 public void Visit(FactoryWorker component)
 {
     // Do nothing
 }
예제 #10
0
 public void ResetFactoryWorker()
 {
     m_worker = null;
 }
예제 #11
0
 public void Visit(FactoryWorker component)
 {
     m_worker = component;           // Storing the worker
 }