示例#1
0
        private ShapeController createShapeController(Sprite shapeSprite)
        {
            GameObject newShape = GameObject.Instantiate(ShapeTemplate, ShapeTemplate.transform.position, canvas.transform.rotation);

            newShape.transform.SetParent(canvas.transform, false);
            newShape.SetActive(true);

            Image image = newShape.GetComponent <Image>();

            image.sprite = shapeSprite;

            ShapeController controller = newShape.AddComponent <ShapeController>();

            canvas.AddShape(controller);
            return(controller);
        }
示例#2
0
        public void AddShape(ShapeController shape)
        {
            shapes.Add(shape);

            ChangeSelectedShape(shapes.Count - 1);
        }