示例#1
0
    void onFinished(OnFlyEnd callBack)
    {
        if (m_bakParent != null)
        {
            gameObject.transform.parent = m_bakParent;
            NGUITools.MarkParentAsChanged(gameObject);
        }

        //if (evt_Finished != null) evt_Finished.Call(null);
        if (callBack != null)
        {
            callBack();
        }

        switch (flyFinishedAction)
        {
        case FlyFinishedAction.DestroyComponet:
            GameObject.Destroy(this);
            break;

        case FlyFinishedAction.DestroyGameobject:
            GameObject.Destroy(this.gameObject);
            break;

        default:
        {
            //启用物体上的碰检盒
            gameObject.EnableCollider(true);
        }
        break;
        }
    }
示例#2
0
        public void StartFly(Vector3 startPos, Vector3 endPos, float speed, float spawnTime, OnFlyEnd callback)
        {
            Vector3 l = endPos - startPos;

            SpawnPos    = startPos;
            FlyDir      = l.normalized;
            SpawnTime   = spawnTime;
            Speed       = speed;
            onFlyEnd    = callback;
            DisposeTime = spawnTime + l.magnitude / speed;
        }
示例#3
0
    //飞行完成时的事件回调

    /*public IQKEvent evt_Finished {
     *  get { return _evt_Finished; }
     *  set { if (_evt_Finished != null) _evt_Finished.Dispose(); _evt_Finished = value; }
     * }
     *
     * IQKEvent _evt_Finished = null;
     */

    public void StartFly(OnFlyEnd callBack)
    {
        if (InFlyLayer)
        {
            m_bakParent = gameObject.transform.parent;
            gameObject.transform.parent = UIFlyRoot.Single.transform;
            NGUITools.MarkParentAsChanged(gameObject);
        }

        //禁用物体上的碰检盒
        gameObject.EnableCollider(false);

        SpringPosition sp = SpringPosition.Begin(gameObject, target, strength);

        sp.worldSpace = worldSpace;
        sp.onFinished = () => onFinished(callBack);
    }