void Awake() { polygon = GetComponent <FilledPolygon>(); polygon.UpdateAlpha(initialAlpha); transform.localScale = new Vector3(LENGTH, initialSize); }
private void BeginDrawingObject(MouseButtonEventArgs e) { Vector mousePos = (Vector)e.GetPosition(MainImageContainer); switch (currentlyPressedButton.Name) { case "DrawLineButon": ILine line = new ClippedLine((Vector)e.GetPosition(MainImageContainer), (Vector)e.GetPosition(MainImageContainer), 2, CurrentColor, ClipRectangles); currentlyDrawnObject = line; DrawingObjects.Add(currentlyDrawnObject); currentlyDrawnPoint = line.Point2; break; case "DrawCircleButton": MidpointCircle circle = new MidpointCircle((Vector)e.GetPosition(MainImageContainer), (Vector)e.GetPosition(MainImageContainer), CurrentColor); currentlyDrawnObject = circle; DrawingObjects.Add(currentlyDrawnObject); currentlyDrawnPoint = circle.radiusUtilityPoint; break; case "DrawPolygonButton": Polygon poly = new FilledPolygon(CurrentColor, 2, ClipRectangles, (Vector)e.GetPosition(MainImageContainer), (Vector)e.GetPosition(MainImageContainer)); currentlyDrawnObject = poly; DrawingObjects.Add(currentlyDrawnObject); currentlyDrawnPoint = poly.Points[1]; break; case "DrawCapsuleButton": Capsule cap = new Capsule(mousePos, mousePos, 0, CurrentColor); currentlyDrawnObject = cap; DrawingObjects.Add(currentlyDrawnObject); currentlyDrawnPoint = cap.Point2; break; case "DrawRectangleButton": DrawingRectangle rec = new DrawingRectangle(CurrentColor, 2, mousePos, mousePos); currentlyDrawnObject = rec; DrawingObjects.Add(currentlyDrawnObject); currentlyDrawnPoint = rec.Points[2]; break; case "FloodFillButton": FloodFill fill = new FloodFill(mousePos, CurrentColor); DrawingObjects.Add(fill); currentState = UIState.PreparingToDraw; break; default: throw new NotImplementedException(); } }
void Start() { polygon = GetComponent <FilledPolygon>(); polygon.UpdateSize(initialSize); }
void Awake() { polygon = GetComponent <FilledPolygon>(); polygon.UpdateSize(0.0f); polygon.UpdateAlpha(initialAlpha); }