Example #1
0
        private static LayerFocus ChangeLayer(int index)
        {
            index = Mathf.Clamp(index, 0, EnumExtend.Length <LayerFocus>() - 1);

            _currentLayerFocus = (LayerFocus)index;
            OnChangeLayer?.Invoke(_currentLayerFocus);
            return(_currentLayerFocus);
        }
        public void SetFocus(LayerFocus layerFocus, bool changeLayer)
        {
            this.layerFocus = layerFocus;

            if (changeLayer)
            {
                _oldLayerFocus = FocusManager.CurrentLayerFocus;

                if (storageFocusedObject)
                {
                    FocusManager.PreserveCurrentFocus();
                }

                FocusManager.ChangeLayer(layerFocus);
            }
        }
        private void OnChangeLayer(LayerFocus currentLayerFocus)
        {
            bool isRightLayer = currentLayerFocus == layerFocus;

            IFocusLayer[] components = includeChildren ? gameObject.GetChildrenInHierarchy <IFocusLayer>().ToArray() : gameObject.GetComponents <IFocusLayer>();
            if (components != null)
            {
                foreach (var component in components)
                {
                    if (component != null)
                    {
                        component.SetFocusLayer(isRightLayer);
                    }
                }
            }
        }
        protected override void OnEnableAfterStart()
        {
            base.OnEnableAfterStart();

            if (setFocusOnEnable)
            {
                if (storageFocusedObject)
                {
                    FocusManager.PreserveCurrentFocus();
                }

                if (useStairFocus)
                {
                    FocusManager.UpLayer();
                }
                else
                {
                    _oldLayerFocus = FocusManager.CurrentLayerFocus;
                    FocusManager.ChangeLayer(layerFocus);
                }
            }
        }
Example #5
0
 private void Update()
 {
     layerFocus = CurrentLayerFocus;
     UpdateSlotArray();
 }
Example #6
0
 public static void ChangeLayer(LayerFocus layerFocus)
 {
     _currentLayerFocus = layerFocus;
     OnChangeLayer?.Invoke(_currentLayerFocus);
 }