| | 1 | | using DCL.ECS7.InternalComponents; |
| | 2 | | using DCL.Models; |
| | 3 | | using System.Collections.Generic; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace ECSSystems.ECSSceneBoundsCheckerSystem |
| | 7 | | { |
| | 8 | | public class ECSOutOfSceneBoundsFeedback_EnabledToggle : IECSOutOfSceneBoundsFeedbackStyle |
| | 9 | | { |
| | 10 | | public void ApplyFeedback(IDCLEntity entity, InternalSceneBoundsCheck sbcComponentModel, bool isVisible, bool is |
| | 11 | | { |
| 0 | 12 | | IList<Renderer> renderers = sbcComponentModel.renderers; |
| 0 | 13 | | KeyValueSet<Collider, uint> physicsColliders = sbcComponentModel.physicsColliders; |
| 0 | 14 | | KeyValueSet<Collider, uint> pointerColliders = sbcComponentModel.pointerColliders; |
| | 15 | |
|
| 0 | 16 | | if (renderers != null) |
| | 17 | | { |
| 0 | 18 | | int count = renderers.Count; |
| | 19 | |
|
| 0 | 20 | | for (var i = 0; i < count; i++) |
| | 21 | | { |
| 0 | 22 | | renderers[i].enabled = isInsideBounds && isVisible; |
| | 23 | | } |
| | 24 | | } |
| | 25 | |
|
| 0 | 26 | | if (physicsColliders != null) |
| | 27 | | { |
| 0 | 28 | | var pairs = physicsColliders.Pairs; |
| 0 | 29 | | for (int i = 0; i < pairs.Count; i++) |
| | 30 | | { |
| 0 | 31 | | pairs[i].key.enabled = isInsideBounds; |
| | 32 | | } |
| | 33 | | } |
| | 34 | |
|
| 0 | 35 | | if (pointerColliders != null) |
| | 36 | | { |
| 0 | 37 | | var pairs = pointerColliders.Pairs; |
| 0 | 38 | | for (int i = 0; i < pairs.Count; i++) |
| | 39 | | { |
| 0 | 40 | | pairs[i].key.enabled = isInsideBounds; |
| | 41 | | } |
| | 42 | | } |
| 0 | 43 | | } |
| | 44 | | } |
| | 45 | | } |