示例#1
0
        public MapImpl()
        {
            mappa   = new Block[COLUMN, ROW];
            factory = new FactoryBlock();

            int x = 0;
            int y = 0;

            string[] lines = File.ReadAllLines(MAP_PATH);
            foreach (string line in lines)
            {
                string[] rowNumbers = line.Split(" ");
                foreach (string number in rowNumbers)
                {
                    int num = Convert.ToInt32(number);
                    switch (num)
                    {
                    case 0:
                        mappa[x, y] = factory.GetObstacleBlock(x, y);
                        break;

                    case 1:
                        mappa[x, y] = factory.GetTerrainBlock(x, y);
                        break;

                    case 2:
                        mappa[x, y] = factory.GetFieldBlock(x, y);
                        break;

                    case 3:
                        mappa[x, y] = factory.GetLockedBlock(x, y);
                        break;

                    case 4:
                        mappa[x, y] = factory.GetWaterBlock(x, y);
                        break;

                    case 5:
                        mappa[x, y] = factory.GetStallBlock(x, y);
                        break;

                    default:
                        break;
                    }
                    x++;
                }
                y++;
                x = 0;
            }
        }
示例#2
0
 public void Setup()
 {
     block = new FactoryBlock();
 }