Ejemplo n.º 1
0
    public override void Action(Element element)
    {
        int x = element.fieldPosition.x, y = element.fieldPosition.y;
        ElementController elementController = element.elementController;
        Field             field = elementController.field;

        new Timer((object state) => {
            if (direction == Direction.Vertical)
            {
                for (int i = 0; i < field.Scales.y; i++)
                {
                    if (field.field[x, i] != null)
                    {
                        elementController.ActivateElement(field.field[x, i]);
                    }
                }
            }
            else if (direction == Direction.Horizontal)
            {
                for (int i = 0; i < field.Scales.x; i++)
                {
                    if (field.field[i, y] != null)
                    {
                        elementController.ActivateElement(field.field[i, y]);
                    }
                }
            }
        }, null, 250, Timeout.Infinite);
    }
Ejemplo n.º 2
0
    public override void Action(Element element)
    {
        int x = element.fieldPosition.x, y = element.fieldPosition.y;
        ElementController elementController = element.elementController;
        Field             field = elementController.field;

        new Timer((object state) =>
        {
            for (int i = x - 1; i <= x + 1; i++)
            {
                for (int j = y - 1; j <= y + 1; j++)
                {
                    if (i >= 0 && i < field.Scales.x &&
                        j >= 0 && j < field.Scales.y &&
                        field.field[i, j] != null)
                    {
                        elementController.ActivateElement(field.field[i, j]);
                    }
                }
            }
        }, null, 250, Timeout.Infinite);
    }