不同方式对 Tween 事件的方法分配

Method Assignment to Tween Event with Different ways

观看下面的代码片段,它运行良好(虽然方法执行尚未测试)并且我的方法已分配给补间 onFinsih。

第一行没有 EventDelgate 而有 EventDelegate?那么将我的自定义方法分配给补间事件的区别和有效方法是什么。

using UnityEngine;
using System.Collections;

public class TweenEventMethodAssigner : MonoBehaviour {

    // Use this for initialization
    void Start () {
        gameObject.GetComponent<TweenPosition>().AddOnFinished(myOnFinish);
        gameObject.GetComponent<TweenPosition>().AddOnFinished(new EventDelegate(myOnFinish2));
    }

    // Update is called once per frame
    void Update () {

    }

    void myOnFinish() {
        Debug.Log("myOwnFinsih");
    }

    void myOnFinish2() {
        Debug.Log("myOwnFinsih : 2");
    }
}

他们都一样。在内部使用第二个版本,而您使用第一个版本。 这只是写同样东西的一种更短的方式。