コード例 #1
0
ファイル: FigureInfo.cs プロジェクト: xewelus/UnityTetris
        public FigureInfo(
            Figure sample,
            Vector2Int localPoint,
            Transform transform,
            Color color,
            FigureAssetScope figureAssetScope,
            GameParameters parameters,
            CubesArray cubesArray,
            AtomCubePool atomCubePool)
        {
            this.Color        = color;
            this.parameters   = parameters;
            this.cubesArray   = cubesArray;
            this.atomCubePool = atomCubePool;

            this.pos = localPoint;

            FigureAsset figureAsset = figureAssetScope.GetRandom();

            Figure figure = Util.CreateLocal(sample, transform, this.pos.ToVector3Int());

            figure.Color = color;

            figure.FigureAsset = figureAsset;
            this.cubesItems    = figure.CreateCubes(atomCubePool);
            this.Figure        = figure;

            List <Vector2> points = figureAsset.GetCubesPositions(0);

            this.rotationInfo = RotationInfo.Create(points);

            this.CheckStartPosition();

            this.UpdatePos();
        }
コード例 #2
0
ファイル: AtomCubePool.cs プロジェクト: xewelus/UnityTetris
        private static Item CreateFunc(AtomCubePool pool, AtomCube sample)
        {
            AtomCube cube = Object.Instantiate(sample);

            Item item = new Item(pool, cube);

            return(item);
        }
コード例 #3
0
ファイル: GameLevel.cs プロジェクト: xewelus/UnityTetris
        public GameLevel(GameDesk gameDesk)
        {
            TweenFactory.DefaultTimeFunc = () => this.timing.deltaTime;

            this.gameDesk     = gameDesk;
            this.atomCubePool = new AtomCubePool(this.gameDesk.AtomCube, MaterialsScope.Cache.Default);

            this.cubesArray              = new CubesArray(gameDesk.Width, gameDesk.Height);
            this.cubesArray.CellChanged += this.CubesArray_OnCellChanged;

            if (gameDesk.Parameters == null)
            {
                throw new Exception("gameDesk.Parameters");
            }
            if (gameDesk.Parameters.Keyboard == null)
            {
                throw new Exception("gameDesk.Parameters.Keyboard");
            }

            this.keyboard = new KeyboardController(gameDesk.Parameters.Keyboard, this.timing);
            KeyboardEvents.Init(this, this.keyboard);
        }
コード例 #4
0
ファイル: AtomCubePool.cs プロジェクト: xewelus/UnityTetris
 public Item(AtomCubePool pool, AtomCube atomCube)
 {
     this.pool     = pool;
     this.AtomCube = atomCube;
     this.renderer = atomCube.GetComponent <Renderer>();
 }