示例#1
0
 private void initializeFieldsMatrix()
 {
     m_fieldMatrix = new Field[m_width, m_height];
     for (int col = 0; col < m_width; col++)
     {
         for (int row = 0; row < height; row++)
         {
             //dostęp do itego elementy macierzy
             m_fieldMatrix[col, row] = new FloorField();
         }
     }
 }
示例#2
0
        public void polymorphPlace()
        {
            Crate crate = new Crate(currentField);
            Truck truck = new Truck(currentField);
            Wall  wall  = new Wall();

            FloorField floorField = new FloorField();
            WallField  wallField  = new WallField();
            EmptyField emptyField = new EmptyField();

            floorField.Place(crate);
            wallField.Place(crate);
            emptyField.Place(crate);
        }
示例#3
0
 override public void Visit(FloorField floorField)
 {
     if (floorField.IsEmpty())
     {
         _fieldRepresentation = '.';
     }
     else if (floorField.Content is Truck)
     {
         _fieldRepresentation = '@';
     }
     else if (floorField.Content is Crate)
     {
         _fieldRepresentation = '#';
     }
 }
示例#4
0
        public void polymorphToChar()
        {
            Crate crate = new Crate(currentField);
            Truck truck = new Truck(currentField);
            Wall  wall  = new Wall();

            FloorField  floorField  = new FloorField();
            TargetField targetField = new TargetField();
            WallField   wallField   = new WallField();
            EmptyField  emptyField  = new EmptyField();

            crate.ToChar();
            truck.ToChar();
            wall.ToChar();

            floorField.ToChar();
            wallField.ToChar();
            emptyField.ToChar();
            targetField.ToChar();
        }