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"); }
/// <summary> /// 监听Cube对象 /// </summary> protected override void Start() { BindingTool bt = BindingTool.GetInstance(); GameObject eventSource = transform.parent.Find("Cube").gameObject; bt.Binding(this.gameObject, eventSource); base.Start(); }
/// <summary> /// 对象间单向通信,一个对象监视另一个对象的变化 /// </summary> protected override void Start() { base.Start(); BindingTool bt = BindingTool.GetInstance(); GameObject eventSource = GameObject.Find("Canvas/SpeedController"); bt.Binding(this.gameObject, eventSource); }
/// <summary> /// Unity Method /// </summary> protected override void Start() { base.Start(); GameObject player = transform.parent.gameObject; BindingTool bindingTool = new BindingTool(); bindingTool.Binding(gameObject, player); }