예제 #1
0
    GraphicEntity1 AddRectAtPosition(int minX, int minY, int width, int height, Color color)
    {
        GridRect emptyRect = new GridRect(minX, minY, width, height);

        if (emptyRect != null)
        {
            var ge = GraphicEntity1.New(emptyRect, board);
            ge.SetColor(color);
            ge.SetOpacity(1, Beat(1));
            return(ge);
        }
        return(null);
    }
예제 #2
0
    public IList <GraphicEntity1> BreakToUnitSquares(float duration = 0)
    {
        var squares = new List <GraphicEntity1>();

        foreach (var gridRect in rect.SplitToUnitSquares())
        {
            var g = GraphicEntity1.New(gridRect, board);
            g.SetColor(animatable.color);
            squares.Add(g);
        }
        Remove(duration, DONTUNLOCK: true);
        return(squares);
        // splits existing x to this as much as it can
    }
예제 #3
0
    GraphicEntity1 AddRect(int width, int height, Color color, bool allowStacking = false)
    {
        GridRect emptyRect = board.FindEmptyRectWithSize(width, height);

        if (emptyRect == null && allowStacking)
        {
            emptyRect = board.FindRandomRectWithSize(width, height);
        }
        if (emptyRect != null)
        {
            var ge = GraphicEntity1.New(emptyRect, board);
            ge.SetColor(color);
            //ge.SetOpacity(opacity, Beat(1));
            return(ge);
        }
        return(null);
    }
예제 #4
0
    bool AddRow(Color color, bool force = false)
    {
        // search for vacant spots
        // MUTEX
        Debug.Log("StoryOfASound: Looking for empty row");
        GridRect emptyRow = board.FindEmptyRow();

        Debug.Log("Found empty row" + emptyRow);
        if (emptyRow == null)
        {
            emptyRow = new GridRect(0, Random.Range(0, rows), cols, 1);
            foreach (var ge in board.GraphicEntities())
            {
                ge.DeleteRect(emptyRow, Beat(1));
            }
        }

        var newGe = GraphicEntity1.New(emptyRow, board);

        newGe.SetColor(color);
        //newGe.SetOpacity(1, Beat(1));
        return(true);
    }
예제 #5
0
    void AddSquareAtPosition(int x, int y, Color color)
    {
        var ge = GraphicEntity1.New(new GridRect(x, y, 1, 1), board);

        ge.SetColor(color);
    }