private void Awake() { behaviour = new MBehaviour(executionPriority, executionOrder, enabled); behaviour.OnAwake(() => { Debug.Log("Awake:" + gameObject); }); behaviour.OnEnable(() => { Debug.Log("Enable " + gameObject); }); behaviour.OnDisable(() => { Debug.Log("OnDisable " + gameObject); }); behaviour.OnUpdate(() => { Debug.Log("OnUpdate " + gameObject); }); behaviour.OnDestroy(() => { Debug.Log("OnDestroy"); }); MBehaviourController.AddBehaviour(behaviour); }
private void Awake() { behaviour = new MBehaviour(ExecutionPriority.Highest, -900, enabled); behaviour.OnAwake(() => { InputHands = new Dictionary <int, MInputHand>(); //初始化手的种类 var handUI = MHandUIManager.CreateHandUI(transform, handSprite, handSize); var inputHand = new MInputHand(0, handUI, OperatePlatform.Mouse); InputHands.Add(0, inputHand); isPlaying = true; //注册操作者相关事件 var operate = MOperateManager.AddOperateHand(inputHand); //注册方法 operate.OnGrab = OnGrabObject; operate.OnSetGrab = SetGrabObject; operate.OnEnable(); }); behaviour.OnUpdate(OnMouseUpdate); MBehaviourController.AddBehaviour(behaviour); }
private void Awake() { behaviour = new MBehaviour(ExecutionPriority.High, -800); behaviour.OnAwake(() => { canvas = GetComponent <Canvas>(); canvas.renderMode = RenderMode.ScreenSpaceCamera; canvas.worldCamera = MUtility.UICamera; }); MBehaviourController.AddBehaviour(behaviour); }