Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        if (!brickPrefab.GetComponent <Brick>())
        {
            throw new Exception("Given brickPrefab does not contain Brick script");
        }

        IsPaused = true;

        instantiatedPool = Instantiate(pool);
        instantiatedPool.PoolUp(width * height);

        tetrisGrid = new TetrisGrid(width, height, groupSize, instantiatedPool);
    }
Ejemplo n.º 2
0
    public BrickTree(Vector3i resolution, Noise2D noise)
    {
        this.noise = noise;

        BrickDimensionX = (int)Math.Pow(2, resolution.x);
        BrickDimensionY = (int)Math.Pow(2, resolution.y);
        BrickDimensionZ = (int)Math.Pow(2, resolution.z);

        octree = new SafeOctree <Brick>(new Vector3(BrickDimensionX, BrickDimensionY, BrickDimensionZ), new Vector3i(0, 0, 0));

        BrickAndModX = BrickDimensionX - 1;
        BrickAndModY = BrickDimensionY - 1;
        BrickAndModZ = BrickDimensionZ - 1;

        pool = new BrickPool(resolution);
    }
Ejemplo n.º 3
0
    public TetrisGrid(int width, int height, int groupSize, BrickPool pool)
    {
        size = new Size(width + 1, height + 1);

        Grid = new Option <Brick> [size.width, size.height];
        InitArray(Grid);

        activeGroup = new Option <Brick> [groupSize];

        //4 because of 4 rotations
        activeShape = new Coordinate[groupSize, 4];

        //Hardcoded aproximate spawn zone location
        spawnPoint = new Coordinate((size.width - 4) / 2, size.height - 2);

        this.pool = pool;
    }