private void HighlightObjectOnUnUse(object sender, ObjectInteraction.InteractableObjectEventArgs e)
        {
            if (_gameObject == null)
            {
                return;
            }

            VarwinHighlightEffect highlighter = _highlightOverriderGameObject
                ? _highlightOverriderGameObject.GetComponent <VarwinHighlightEffect>()
                : _gameObject.GetComponent <VarwinHighlightEffect>();

            if (highlighter == null)
            {
                return;
            }

            if (highlighter.IsHighlightEnabled)
            {
                _lastHighlightedInputController?.UnHighlightObject(this, e);
                highlighter.SetHighlightEnabled(true);
            }

            highlighter.SetConfiguration(DefaultHighlightConfig);
            _lastHighlightedInputController = this;
        }
        private void OnDestroy()
        {
            if (_childColliders != null && _childColliders.Count > 0)
            {
                foreach (Collider childCollider in _childColliders)
                {
                    childCollider.enabled = true;
                }
            }

            if (_tempColliders != null)
            {
                foreach (CollisionControllerElement collisionControllerElement in _tempColliders)
                {
                    collisionControllerElement.OnTriggerExitDelegate    -= OnColliderExit;
                    collisionControllerElement.OnCollisionEnterDelegate -= OnCollide;
                    Destroy(collisionControllerElement.gameObject);
                }
            }

            _inputController?.EnableDrop();

            ProjectData.GameModeChanged -= GameModeChanged;

            _highlight = gameObject.GetComponent <VarwinHighlightEffect>();
            _highlight.SetConfiguration(_defaultHighlightConfig);
        }
        private void AddHighLighter(IHighlightAware highlight)
        {
            DefaultHighlightConfig = highlight.HightLightConfig();

            VarwinHighlightEffect highlighter = _highlightOverriderGameObject
                ? _highlightOverriderGameObject.GetComponent <VarwinHighlightEffect>()
                : _gameObject.GetComponent <VarwinHighlightEffect>();

            if (highlighter == null)
            {
                highlighter = _highlightOverriderGameObject
                    ? _highlightOverriderGameObject.AddComponent <VarwinHighlightEffect>()
                    : _gameObject.AddComponent <VarwinHighlightEffect>();
            }

            try
            {
                highlighter.SetConfiguration(DefaultHighlightConfig);
            }
            catch (Exception)
            {
                LogManager.GetCurrentClassLogger().Error($"Can not add highlight to game object = {_gameObject}");
            }
        }
        public void InitializeController(InputController inputController = null)
        {
            _inputController = inputController;

            if (_inputController != null)
            {
                _defaultHighlightConfig = _inputController.DefaultHighlightConfig;
            }
            else
            {
                var defHighlighter = gameObject.AddComponent <DefaultHightlighter>();
                _defaultHighlightConfig = defHighlighter.HightLightConfig();
            }

            _highlight = gameObject.GetComponent <VarwinHighlightEffect>();

            if (_highlight == null)
            {
                _highlight = gameObject.AddComponent <VarwinHighlightEffect>();
            }


            HightLightConfig config = new HightLightConfig(true,
                                                           0.3f,
                                                           Color.red,
                                                           false,
                                                           0.2f,
                                                           0.1f,
                                                           0.3f,
                                                           Color.red,
                                                           false,
                                                           0.8f,
                                                           0.5f,
                                                           Color.red,
                                                           true,
                                                           0.5f,
                                                           1.0f,
                                                           Color.red);


            _collisionControllerHighlightConfig = config;

            _highlight.SetConfiguration(_collisionControllerHighlightConfig);

            _tempColliders  = new List <CollisionControllerElement>();
            _childColliders = new List <Collider>();

            List <GameObject> objectsWithColliders = new List <GameObject>();

            Collider[] children = GetComponentsInChildren <Collider>();

            foreach (Collider child in children)
            {
                if (!child.isTrigger && child.enabled)
                {
                    _childColliders.Add(child);

                    if (!objectsWithColliders.Contains(child.gameObject))
                    {
                        objectsWithColliders.Add(child.gameObject);
                    }
                }
            }

            foreach (GameObject objectWithCollider in objectsWithColliders)
            {
                CollisionControllerElement triggerObject = CreateTriggersColliders(objectWithCollider);
                triggerObject.OnCollisionEnterDelegate += OnCollide;
                triggerObject.OnTriggerExitDelegate    += OnColliderExit;
                _tempColliders.Add(triggerObject);
            }

            ProjectData.GameModeChanged += GameModeChanged;
        }