private static void SetBlockers(string cellData, CubeModel cube)
        {
            var stringParts = cellData.Split('_');

            if (stringParts.Length > 1)
            {
                var locks     = stringParts[1];
                var setLocks  = new List <MoveInput>();
                var lockCount = 0;

                if (locks.Contains('t'))
                {
                    setLocks.Add(MoveInput.SwipeUp); lockCount++;
                }
                if (locks.Contains('b'))
                {
                    setLocks.Add(MoveInput.SwipeDown); lockCount++;
                }
                if (locks.Contains('r'))
                {
                    setLocks.Add(MoveInput.SwipeRight); lockCount++;
                }
                if (locks.Contains('l'))
                {
                    setLocks.Add(MoveInput.SwipeLeft); lockCount++;
                }

                var lockArray = new MoveInput[lockCount];
                setLocks.CopyTo(lockArray);

                cube.Lock(lockArray);
            }
        }
Exemplo n.º 2
0
 public void Setup(int column, int row, Colour backgroundColour, CubeModel cube, bool lockedHorizontally, bool lockedVertically)
 {
     Column = column;
     Row    = row;
     SetupCube(cube);
     SetupBackground(backgroundColour, lockedHorizontally, lockedVertically);
 }
Exemplo n.º 3
0
 public void SetColor(CubeModel model, bool transparent)
 {
     Front.material  = GetMaterialForColour(model.Front, transparent);
     Back.material   = GetMaterialForColour(model.Back, transparent);
     Left.material   = GetMaterialForColour(model.Left, transparent);
     Right.material  = GetMaterialForColour(model.Right, transparent);
     Top.material    = GetMaterialForColour(model.Top, transparent);
     Bottom.material = GetMaterialForColour(model.Bottom, transparent);
 }
        public static CubeModel[] ParseForeground(List <string> level, int cols, int rows)
        {
            var cubes = new CubeModel[cols * rows];

            for (int i = 0; i < level.Count; ++i)
            {
                cubes[i] = ParseCube(level[i]);
            }

            return(cubes);
        }
Exemplo n.º 5
0
 private void SetupCube(CubeModel cube)
 {
     if (cube != null)
     {
         Cube.gameObject.SetActive(true);
         Cube.Setup(cube);
     }
     else
     {
         Cube.gameObject.SetActive(false);
     }
 }
        public static CubeModel CreateCubeFromConfig(string cellData)
        {
            var front  = Parser.ParseColour(cellData[2]);
            var back   = Parser.ParseColour(cellData[3]);
            var left   = Parser.ParseColour(cellData[4]);
            var right  = Parser.ParseColour(cellData[5]);
            var top    = Parser.ParseColour(cellData[6]);
            var bottom = Parser.ParseColour(cellData[7]);

            var cube = new CubeModel(front, back, left, right, top, bottom);

            SetBlockers(cellData, cube);

            return(cube);
        }
Exemplo n.º 7
0
 public void Setup(CubeModel model)
 {
     _model = model;
     SetColor(_model, false);
     Blockers.Setup(model);
 }
Exemplo n.º 8
0
 private void SetupCellData(int column, int row, CellScript cell, Colour bgColour, CubeModel cube, bool lockedHorizontally,
                            bool lockedVertically)
 {
     cell.Setup(column, row, bgColour, cube, lockedHorizontally, lockedVertically);
 }