void OnEnable() { valueMonitorPool = new ValueMonitorPool(); valueMonitorPool.AddMonitor <bool>(() => { return(isEditing); }, (bool from, bool to) => { if (to) { SceneView.onSceneGUIDelegate = (SceneView.OnSceneFunc)Delegate.RemoveAll(SceneView.onSceneGUIDelegate, new SceneView.OnSceneFunc(this.OnSceneGUICallback_Move)); SceneView.onSceneGUIDelegate = (SceneView.OnSceneFunc)Delegate.Combine(SceneView.onSceneGUIDelegate, new SceneView.OnSceneFunc(this.OnSceneGUICallback_Move)); } else { SceneView.onSceneGUIDelegate = (SceneView.OnSceneFunc)Delegate.RemoveAll(SceneView.onSceneGUIDelegate, new SceneView.OnSceneFunc(this.OnSceneGUICallback_Move)); } }); EditorUpdateRunner.AddUpdateIfNot("MapEditorManager", () => { EditorUpdate(); }); }
private void Init() { HPBar = UI.asProgress; HPText = UI.GetChild("MonsterHPText").asTextField; roleController = transform.parent.transform.GetComponent <RoleController>(); valueMonitorPool.AddMonitor(() => roleController._roleData.Hp, (f, f1) => { SetHP(roleController._roleData.Hp); }, true); }
private void OnEnable() { valueMonitorPool.AddMonitor <UnityEngine.Object>(() => { return(target); }, (UnityEngine.Object from, UnityEngine.Object to) => { roleController = target as RoleController; }); }
public void Init() { valueMonitorPool.AddMonitor(() => roleController.SceneId == SceneManager.Instance.CurrSceneId, (f, t) => { if (t) { MessageManager.Instance.Dispatch(MessageName.SHOW_BOSS_HP_UI); } else { MessageManager.Instance.Dispatch(MessageName.HIDE_BOSS_HP_UI); } }, true); valueMonitorPool.AddMonitor(() => roleController._roleData.Hp, (f, t) => { MessageManager.Instance.Dispatch(MessageName.SET_PLAYER1_BOSS_HP, new object [] { roleController.Hp, roleController.HpMax }); }, true); valueMonitorPool.AddMonitor(() => roleController._roleData.HpMax, (f, t) => { MessageManager.Instance.Dispatch(MessageName.SET_PLAYER1_BOSS_HP, new object [] { roleController.Hp, roleController.HpMax }); }, true); }
private void Start() { var Joy = transform.parent.parent; if (!Joy) { return; } var Anim = Joy.GetComponentInChildren <Animator>(); if (!Anim) { return; } valueMonitorPool.Clear(); valueMonitorPool.AddMonitor(() => Anim.GetCurrAnimNameHash(), (from, to) => { this.ExecuteTrigger(Joy.gameObject); }); }