Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        private static Item CreateFunc(AtomCubePool pool, AtomCube sample)
        {
            AtomCube cube = Object.Instantiate(sample);

            Item item = new Item(pool, cube);

            return(item);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 public Item(AtomCubePool pool, AtomCube atomCube)
 {
     this.pool     = pool;
     this.AtomCube = atomCube;
     this.renderer = atomCube.GetComponent <Renderer>();
 }