private void OnTriggerEnter(Collider other) { BindingTool bt = BindingTool.GetInstance(); #region 手机的绑定 var testQiumodel = other.GetComponent <TestQiuModel>(); var testQiuEntity = utilsEntity.GetEntity <TestQiuEntity>(other.gameObject); var testTaModel = GetComponent <TestTaModel>(); var testTaEntity = utilsEntity.GetEntity <TestTaEntity>(gameObject); //先解绑 if (testQiuEntity != null && testQiuEntity.bindingTa != null) { bt.Unbinding(testQiumodel, testQiuEntity.bindingTa); bt.Unbinding(testTaModel, testQiuEntity); testQiuEntity.bindingTa = null; testQiuEntity.bindQiu = null; } //再绑定 bt.Binding(testQiumodel, testTaModel); testQiuEntity.bindingTa = testTaEntity; testTaEntity.testQiuEntityList.Add(testQiuEntity); #endregion #region 基站的绑定 //bt.Binding(testTaModel, testQiumodel); #endregion Debug.Log("OnTriggerEnter"); }
private void OnTriggerExit(Collider other) { var testQiumodel = other.GetComponent <TestQiuModel>(); var testQiuEntity = utilsEntity.GetEntity <TestQiuEntity>(other.gameObject); var testTaModel = GetComponent <TestTaModel>(); var testTaEntity = utilsEntity.GetEntity <TestTaEntity>(gameObject); //testQiumodel.Unwatch(testTaModel, "beihuijiao"); BindingTool bt = BindingTool.GetInstance(); bt.Unbinding(gameObject, other.gameObject); bt.Unbinding(other.gameObject, gameObject); //testTaEntity.callList.RemovePropertyChangeListener(testTaEntity.callList); testQiuEntity.bindingTa = null; Debug.Log("OnTriggerExit"); }