void OnSceneGUI() { SkyMoveByCurve mObject = (SkyMoveByCurve)target; Transform starTransform = mObject.transform.parent.transform; Quaternion rotation = Quaternion.Euler(0f, 0f, 0f); mObject.getNewSize(); for (int i = 0; i < mObject.targets.Length; i++) { Vector3 temp = SkyUtil.reletiveToLocal(mObject.targets [i].local, mObject.parentWidth, mObject.parentHight); Vector3 oldPoint = starTransform.TransformPoint(rotation * temp); Vector3 newPoint = Handles.FreeMoveHandle (oldPoint, Quaternion.identity, 0.1f, pointSnap, Handles.DotCap); if (oldPoint != newPoint) { mObject.IsDirty = true; mObject.targets [i].local = Quaternion.Inverse(rotation) * starTransform.InverseTransformPoint(newPoint); mObject.targets [i].local.x = mObject.targets [i].local.x / mObject.parentWidth + 0.5f; mObject.targets [i].local.y = mObject.targets [i].local.y / mObject.parentHight + 0.5f; mObject.myUpdate(); } } }
public override void PlayLoop() { base.PlayLoop(); gameObject.SetActive(true); transform.localScale = Vector3.one; transform.localPosition = SkyUtil.reletiveToLocal(targets [0].local, parentWidth, parentHight); computePath(); mSequence = SkyAnimator.moveToSequence(gameObject, times, positions, true, SkyAniDuration.Linear, PlayCallBack); }
public override void PlayLoop() { base.PlayLoop(); gameObject.SetActive(true); transform.localScale = scaleMin; transform.localPosition = SkyUtil.reletiveToLocal(positionMin, parentWidth, parentHight); SkyAnimator.moveTo(gameObject, PlayTime / 2f, SkyUtil.reletiveToLocal(positionMid, parentWidth, parentHight), true, PositionSkyAniDuration, positionFirstComplete); SkyAnimator.scaleTo(gameObject, PlayTime / 2f, scaleMax, SkyAniDuration.Linear, scalFirstComplete); SkyAnimator.colorTo(mImage, PlayTime / 2f, colorMax, SkyAniDuration.Linear, colorFirstComplete); }
void OnSceneGUI() { TestForEditor testForEditor = (TestForEditor)target; Transform starTransform = testForEditor.transform; Quaternion rotation = Quaternion.Euler(0f, 0f, 0f); testForEditor.getNewSize(); Vector3 temp = SkyUtil.reletiveToLocal(testForEditor.point, testForEditor.parentWidth, testForEditor.parentHight); Vector3 oldPoint = starTransform.TransformPoint(rotation * temp); Vector3 newPoint = Handles.FreeMoveHandle (oldPoint, Quaternion.identity, 0.1f, pointSnap, Handles.DotCap); if (oldPoint != newPoint) { testForEditor.point = Quaternion.Inverse(rotation) * starTransform.InverseTransformPoint(newPoint); testForEditor.point.x = testForEditor.point.x / testForEditor.parentWidth + 0.5f; testForEditor.point.y = testForEditor.point.y / testForEditor.parentHight + 0.5f; testForEditor.myUpdate(); } }
public override void Init() { base.Init(); RectTransform parentTransform = transform.parent.transform as RectTransform; parentHight = parentTransform.rect.height; parentWidth = parentTransform.rect.width; mImage = GetComponent <Image> (); mImage.color = colorMin; scalFirstComplete = new SkyAniCallBack(); scalFirstComplete.SetCompleteMethod(() => { SkyAnimator.scaleTo(gameObject, PlayTime / 2f, scaleMin, SkyAniDuration.Linear, null); }); positionFirstComplete = new SkyAniCallBack(); positionFirstComplete.AddCompleteMethod(() => { SkyAnimator.moveTo(gameObject, PlayTime / 2f, SkyUtil.reletiveToLocal(positionMax, parentWidth, parentHight), true, PositionSkyAniDuration, PlayCallBack); }); colorFirstComplete = new SkyAniCallBack(); colorFirstComplete.SetCompleteMethod(() => { SkyAnimator.colorTo(mImage, PlayTime / 2f, colorMin, SkyAniDuration.Linear, null); }); }
public void computePath() { if (IsDirty) { getNewSize(); times.Clear(); positions.Clear(); for (int i = 0; i < targets.Length; i++) { positions.Add(SkyUtil.reletiveToLocal(targets [i].local, parentWidth, parentHight)); if (i == 0) { times.Add(0); } else { times.Add(Vector3.Distance(positions [i - 1], positions [i])); } } float sum = 0; for (int i = 0; i < times.Count; i++) { sum += times [i]; } if (sum != 0) { for (int i = 0; i < times.Count; i++) { times [i] *= PlayTime; times [i] /= sum; } } IsDirty = false; } }