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); }
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); }
void Start() { if (m_MyEvent == null) { m_MyEvent = new MyIntEvent(); } m_MyEvent.AddListener(Ping); }
private void Start() { animator = GetComponent <Animator>(); animState = animator.GetCurrentAnimatorStateInfo(0); //girl_Combo_ZZZ.AddListener(qwe); m_MyEvent = new MyIntEvent(); m_MyEvent.AddListener(qwe); }
private void InitEventHandlers() { if (_scoreCountingEvent == null) { _scoreCountingEvent = new MyIntEvent(); } if (_totalScoreCountingEvent == null) { _totalScoreCountingEvent = new MyIntEvent(); } _scoreCountingEvent.AddListener(CountCurrentScore); _totalScoreCountingEvent.AddListener(CountTotalScore); }
// 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); // 今回は、インスペクター上でも追加したよ }
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); }
private void Start() { MyIntEvent observer = FindObjectOfType <Score>().observer; observer.AddListener(SetScore); }
// Start is called before the first frame update void Start() { updateScoreText.AddListener(UpdateScoreText); }
// Start is called before the first frame update void Start() { var canvas = GameObject.Find("Canvas").GetComponent <UIManager>(); collideBottom.AddListener(canvas.changeLife); }
public override void AddListener(UnityAction <int> action) { OnTrigger.AddListener(action); }