Ejemplo n.º 1
0
 public FieldSystem(Field field, PrintCharTable table)
     : base(field)
 {
     this.field = field;
     this.table = table;
     values = new int [xSize, ySize];
 }
Ejemplo n.º 2
0
        public FlowSystem(
			Field field,
			PrintCharTable table,
			int dropAmount = DROP_AMOUNT,
			int dropMin = DROP_MIN,
			int dropMax = DROP_MAX,
			int initLimit = INIT_LIMIT,
			int maxDelta = MAX_DELTA
			)
            : base(field, table)
        {
            this.maxDelta = maxDelta;

            // dropping initial shafts of water

            for (int i=0; i<dropAmount; i++) {

                int size = rnd.Next (dropMin, dropMax);
                values [field.randomX (), field.randomY ()] = size;

            }

            // to some OK position

            for (int i=0; i<initLimit; i++)
                if (!PerformFlow ())
                    break;
        }
Ejemplo n.º 3
0
        /*
         * Global
         */
        public Field(int xSize = 40, int ySize = 120)
            : base(xSize, ySize)
        {
            // creating object table

            for (int x=0; x<xSize; x++)
                objectsOnField.Add (new List<List<FieldObject>> ());

            foreach (List<List<FieldObject>> column in objectsOnField)
                for (int y=0; y<ySize; y++)
                    column.Add (new List<FieldObject> ());

            // creating height table

            PrintCharTable terrainPrintTable = new PrintCharTable();

            terrainPrintTable.defaultLowChar = '.';
            terrainPrintTable.printChars.Add(7, '^');
            terrainPrintTable.defaultHiChar = '^';

            terrain = new FlowSystem(
                this,
                terrainPrintTable,
                TERRAIN_DROP_AMOUNT,
                TERRAIN_DROP_MIN,
                TERRAIN_DROP_MAX,
                TERRAIN_INIT_LIMIT,
                TERRAIN_MAX_DELTA
                );

            // creating water

            PrintCharTable waterPrintTable = new PrintCharTable();

            waterPrintTable.defaultLowChar = null;
            waterPrintTable.printChars.Add(3, '-');
            waterPrintTable.printChars.Add(5, '~');
            waterPrintTable.printChars.Add(7, '=');
            waterPrintTable.defaultHiChar = '#';

            water = new FlowSystem(
                this,
                waterPrintTable,
                WATER_DROP_AMOUNT,
                WATER_DROP_MIN,
                WATER_DROP_MAX,
                WATER_INIT_LIMIT,
                WATER_MAX_DELTA
                );

            // creating grass table

            grass = new int [xSize, ySize];

            // creating buffer for printing

            buffer = new char[xSize][];

            for (int x=0; x<xSize; x++)
                buffer[x] = new char[ySize];
        }