예제 #1
0
    void Start()
    {
        // c# events

        myEvent        += OnEvent;
        myEventParams1 += OnEventParams1;
        myEventParams1 += OnEventParams1v2;
        myEventParams2 += OnEventParams2;
        myEventReturn  += OnEventReturn;
        myEventReturn  += OnEventReturn;
        myEventReturn  += OnEventReturnV2;

        // unity events

        if (myUnityEvent == null)
        {
            myUnityEvent = new UnityEvent();
        }

        myUnityEvent.AddListener(OnUnityEvent);

        if (myUnityIntEvent == null)
        {
            myUnityIntEvent = new MyIntEvent();
        }

        myUnityIntEvent.AddListener(OnUnityIntEvent);
    }
예제 #2
0
    private void AddListeners()
    {
        onStartEvent.AddListener(OnMyCallback);                       // Note: NOT OnStartEvent += MyCallbackA;
        onStartEvent.AddListener(delegate { OnMyCallbackInt(0); });
        // OnStartEvent.AddListener(() => MyCallbackB(0));          // Lambda Expression for delegate { MyCallbackB(0); };

        onMyIntEvent.AddListener(OnMyCallbackInt);
        onMyEvent.AddListener(OnMyCallbackInt);
    }
예제 #3
0
    void Start()
    {
        if (m_MyEvent == null)
        {
            m_MyEvent = new MyIntEvent();
        }

        m_MyEvent.AddListener(Ping);
    }
예제 #4
0
    private void Start()
    {
        animator = GetComponent <Animator>();

        animState = animator.GetCurrentAnimatorStateInfo(0);

        //girl_Combo_ZZZ.AddListener(qwe);

        m_MyEvent = new MyIntEvent();

        m_MyEvent.AddListener(qwe);
    }
예제 #5
0
    private void InitEventHandlers()
    {
        if (_scoreCountingEvent == null)
        {
            _scoreCountingEvent = new MyIntEvent();
        }

        if (_totalScoreCountingEvent == null)
        {
            _totalScoreCountingEvent = new MyIntEvent();
        }

        _scoreCountingEvent.AddListener(CountCurrentScore);

        _totalScoreCountingEvent.AddListener(CountTotalScore);
    }
예제 #6
0
    // Start is called before the first frame update
    void Start()
    {
        // 参照先がなければ、新たなインスタンス作成
        if (myEvent == null)
        {
            myEvent = new UnityEvent();
        }

        // Add a listener to the new Event. Calls MyEvent method when invoked
        // 非永続的なイベントは、AddListenerで追加することで呼び出すことが出来る。
        // 永続的なイベント : InspectorのButtonコンポーネントにスクリプトをアタッチしてイベント登録されたイベントなど
        myEvent.AddListener(MyEvent);


        // 型が異なるイベント関数を追加 : 引数ごとに追加してる?
        myEvent_1.AddListener(MyEvent1);
        // 今回は、インスペクター上でも追加したよ
    }
예제 #7
0
    private void InitEventHandling()
    {
        // MyIntEvent class is found inside Student script
        if (_asleepEvent == null)
        {
            _asleepEvent = new MyIntEvent();
        }
        _asleepEvent.AddListener(SetVisible);

        if (_awakeEvent == null)
        {
            _awakeEvent = new MyIntEvent();
        }
        _awakeEvent.AddListener(SetInvisible);

        if (_fallOkEvent == null)
        {
            _fallOkEvent = new MyIntEvent();
        }
        _fallOkEvent.AddListener(SetFallOk);
    }
예제 #8
0
    private void Start()
    {
        MyIntEvent observer = FindObjectOfType <Score>().observer;

        observer.AddListener(SetScore);
    }
 // Start is called before the first frame update
 void Start()
 {
     updateScoreText.AddListener(UpdateScoreText);
 }
예제 #10
0
    // Start is called before the first frame update
    void Start()
    {
        var canvas = GameObject.Find("Canvas").GetComponent <UIManager>();

        collideBottom.AddListener(canvas.changeLife);
    }
예제 #11
0
 public override void AddListener(UnityAction <int> action)
 {
     OnTrigger.AddListener(action);
 }