/// <summary> /// Raises the end drag event. /// </summary> /// <param name="eventData">Event data.</param> public virtual void OnEndDrag(PointerEventData eventData) { Vector2 points = btnToggleGraphics.rectTransform.anchoredPosition; points [0] = Mathf.Clamp(points.x, -(Mathf.Abs(btnToggleGraphicsPosition.x)), (Mathf.Abs(btnToggleGraphicsPosition.x))); btnToggleGraphics.rectTransform.anchoredPosition = points; bool toggleStatus = (points.x < 0F) ? false : true; EGTween.MoveTo(btnToggleGraphics.gameObject, EGTween.Hash("x", (toggleStatus ? (Mathf.Abs(btnToggleGraphicsPosition.x)) : -(Mathf.Abs(btnToggleGraphicsPosition.x))), "isLocal", true, "time", 0.5F, "easeType", EGTween.EaseType.easeOutExpo)); OnToggleStatusChanged(toggleStatus); }
void HandAnimation() { if (HelpContent.FindChild("txt-help1").gameObject.activeSelf) { targetPosition = BlockManager.instance.BlockList.Find(o => o.rowId == 2 && o.columnId == 1).block.transform.position; blockPosition = blockContainer.GetChild(0).GetChild(0).position; } else { targetPosition = BlockManager.instance.BlockList.Find(o => o.rowId == 1 && o.columnId == 2).block.transform.position; blockPosition = blockContainer.GetChild(2).GetChild(0).position; } blockPosition.z = 0; targetPosition.z = 0; handImage.transform.position = blockPosition; handImage.gameObject.SetActive(true); EGTween.MoveTo(handImage.gameObject, EGTween.Hash("Delay", 1F, "x", targetPosition.x, "y", targetPosition.y, "time", 2.5f, "easeType", EGTween.EaseType.linear)); Invoke("RepeatHandAnimation", 4.5f); }
void RepeatHandAnimation() { handImage.transform.position = blockPosition; EGTween.MoveTo(handImage.gameObject, EGTween.Hash("Delay", 0.5F, "x", targetPosition.x, "y", targetPosition.y, "time", 2.5f, "easeType", EGTween.EaseType.linear)); Invoke("RepeatHandAnimation", 4.0f); }
/// <summary> /// Swaps the object. /// </summary> /// <param name="parentBlock">Parent block.</param> /// <param name="blockToTansit">Block to tansit.</param> public void swapObject(Transform parentBlock, Transform blockToTansit) { blockToTansit.SetParent(parentBlock); EGTween.MoveTo(blockToTansit.gameObject, EGTween.Hash("isLocal", true, "x", 0, "time", blockTransitionTime)); }
public static void MoveTo(this GameObject target, Hashtable args) { EGTween.MoveTo(target, args); }
public static void MoveTo(this GameObject target, Vector3 position, float time) { EGTween.MoveTo(target, EGTween.Hash("position", position, "time", time)); }