【问题标题】:Method Assignment to Tween Event with Different ways使用不同方式对 Tween 事件进行方法分配
【发布时间】:2016-02-19 06:47:30
【问题描述】:

观看下面的代码 sn-p,它工作正常(虽然方法执行尚未测试)并且我的方法已分配给补间 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");
    }
}

【问题讨论】:

    标签: c# unity3d tween ngui


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2018-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-26
      • 2010-10-14
      • 1970-01-01
      • 2016-12-01
      • 1970-01-01
      相关资源
      最近更新 更多