Exemple #1
0
        public void MoveDownDropObject(int step = 1)
        {
            if (IsDropObjectActive)
            {
                if (CanDropObjectMoveDown())
                {
                    var oldPoints = GetDropObjectRelativePoints();

                    positionObjectField -= new Vector2Int(0, step);

                    var newPoints = GetDropObjectRelativePoints();

                    ChangeObjectEvent?.Invoke(oldPoints, newPoints);
                }
                else
                {
                    var points     = GetDropObjectRelativePoints();
                    var leftPoints = objectField.GetLeftRelativePoints().Select(el => new PointField(positionObjectField) + el).ToArray();

                    FixDropObject(points);

                    CheckForDestroyLines(leftPoints);
                }
            }
        }
Exemple #2
0
        public void RotateDropObject()
        {
            if (IsDropObjectActive)
            {
                if (CanDropObjectRotate())
                {
                    var oldPoints = GetDropObjectRelativePoints();

                    objectField = objectField.RotateRight();

                    var newPoints = GetDropObjectRelativePoints();

                    ChangeObjectEvent?.Invoke(oldPoints, newPoints);
                }
            }
        }
Exemple #3
0
        public void MoveRightDropObject(int step = 1)
        {
            if (IsDropObjectActive)
            {
                if (CanDropObjectMoveRight())
                {
                    var oldPoints = GetDropObjectRelativePoints();

                    positionObjectField += new Vector2Int(step, 0);

                    var newPoints = GetDropObjectRelativePoints();

                    ChangeObjectEvent?.Invoke(oldPoints, newPoints);
                }
            }
        }