예제 #1
0
    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();
            }
        }
    }
예제 #2
0
 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);
 }
예제 #3
0
 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);
 }
예제 #4
0
    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();
        }
    }
예제 #5
0
    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);
        });
    }
예제 #6
0
    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;
        }
    }