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

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

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

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