private void DraggablePipe_AbortDragging(PathDraggable sender, float percentage) { if (percentage >= this.triggerPercentage) { this.draggablePipe.StopDragging -= DraggablePipe_AbortDragging; this.draggablePipe.GetComponent <Clickable>().enabled = false; this.draggablePipe.enabled = false; End(); } }
private void Awake() { pathDraggable = GetComponent <PathDraggable>(); animationDraggable = GetComponent <AnimationDraggable>(); var arrow = new GameObject("Arrow", typeof(RectTransform), typeof(SVGImage)); arrowTransform = arrow.GetComponent <RectTransform>(); arrowTransform.SetParent(transform); arrowTransform.localPosition = Vector3.zero; arrowTransform.localScale = Vector3.one; arrowTransform.localRotation = Quaternion.identity; arrowTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 1); arrowTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 1); image = arrow.GetComponent <SVGImage>(); if (sprite != null) { image.sprite = sprite; } }
void Start() { PathDraggable p = GetComponent <PathDraggable>(); p.OnArrive += P_OnArrive; }
private void P_OnArrive(PathDraggable sender, float percentage) { string location = (percentage.Equals(1f)) ? "END" : "START"; Debug.Log("ARRIVED: " + location + " (" + percentage.ToString() + ")"); }
void Start() { this.draggablePipe = GetComponent <PathDraggable>(); this.draggablePipe.StopDragging += DraggablePipe_AbortDragging; }