void OnDestroy() { if (btnMove_L != null && btnMove_R != null && btnJump != null) { MyEventTriger.GetEvent(btnMove_R).onDown -= OnBtnDown; MyEventTriger.GetEvent(btnMove_R).onUp -= OnBtnUp; MyEventTriger.GetEvent(btnJump).onDown -= OnBtnDown; MyEventTriger.GetEvent(btnMove_L).onDown -= OnBtnDown; MyEventTriger.GetEvent(btnMove_L).onUp -= OnBtnUp; } }
void Start() { //绑定按钮事件 if (btnMove_L != null && btnMove_R != null && btnJump != null) { MyEventTriger.GetEvent(btnMove_R).onDown += OnBtnDown; MyEventTriger.GetEvent(btnMove_R).onUp += OnBtnUp; MyEventTriger.GetEvent(btnJump).onDown += OnBtnDown; MyEventTriger.GetEvent(btnMove_L).onDown += OnBtnDown; MyEventTriger.GetEvent(btnMove_L).onUp += OnBtnUp; } }