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; }
/// <summary> /// Подсвечиваем и убираем коллайдеры /// </summary> private void Block() { if (_isBlocked) { return; } TurnCollidersOn(false); if (_highlight != null) { _highlight.SetHighlightEnabled(true); _highlight.SetConfiguration(_collisionControllerHighlightConfig); } if (_inputController != null && ProjectData.GameMode == GameMode.Edit && !_isBlocked) { _inputController.ControllerEvents.GripPressed += OnGripPressed; } _isBlocked = true; }
private void UnHighlightObject(object sender, ObjectInteraction.InteractableObjectEventArgs e) { if (_gameObject == null) { return; } VarwinHighlightEffect highlighter = _highlightOverriderGameObject ? _highlightOverriderGameObject.GetComponent <VarwinHighlightEffect>() : _gameObject.GetComponent <VarwinHighlightEffect>(); if (highlighter == null) { return; } highlighter.SetHighlightEnabled(false); if (_lastHighlightedInputController == this) { _lastHighlightedInputController = null; } else { _nextToHighlightInputController = this; } if (_nextToHighlightInputController != null) { if (_nextToHighlightInputController != this) { _nextToHighlightInputController.HighlightObject(this, e); } _nextToHighlightInputController = null; } if (sender == null) { return; } if (sender.GetType() == typeof(InputController)) { _nextToHighlightInputController = this; } }