Пример #1
0
        // Start is called before the first frame update
        void Start()
        {
            var rectangles = new OrderedDynamicArray <Rectangle>();

            rectangles.Add(new Rectangle(3, 4));
            rectangles.Add(new Rectangle(2, 2));
            rectangles.Add(new Rectangle(1, 2));
        }
Пример #2
0
    private void Start()
    {
        rectangles.Add(new Rectangle(3, 2));
        rectangles.Add(new Rectangle(2, 2));
        rectangles.Add(new Rectangle(1, 2));

        for (int i = 0; i < rectangles.Count; i++)
        {
            lines.Add(Instantiate(linePrefab));
        }


        for (int i = 0; i < lines.Count; i++)
        {
            Vector2 size = new Vector2(rectangles.GetElement(i).Width, rectangles.GetElement(i).Height);
            lines[i].GetComponent <LineManager>().DrawRectangle(positions[i].transform.position, size);
        }
    }