| | 1 | | using System.Collections; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using DCL.Builder; |
| | 4 | | using DCL.Helpers; |
| | 5 | | using UnityEditor; |
| | 6 | | using UnityEngine; |
| | 7 | |
|
| | 8 | | public class BIWGizmosAxis : MonoBehaviour, IBIWGizmosAxis |
| | 9 | | { |
| | 10 | | public Color defaultColor; |
| | 11 | | public Color highLightColor; |
| | 12 | | public Renderer objectRenderer; |
| | 13 | |
|
| | 14 | | private MaterialPropertyBlock props; |
| | 15 | |
|
| | 16 | | private IBIWGizmos gizmo = null; |
| | 17 | |
|
| 0 | 18 | | public void SetGizmo(IBIWGizmos parentGizmo) { gizmo = parentGizmo; } |
| | 19 | |
|
| 1 | 20 | | public IBIWGizmos GetGizmo() { return gizmo; } |
| 8 | 21 | | public Transform axisTransform => transform; |
| | 22 | |
|
| | 23 | | public void SetColorHighlight() |
| | 24 | | { |
| 1 | 25 | | if (props == null) |
| 1 | 26 | | return; |
| | 27 | |
|
| 0 | 28 | | objectRenderer.GetPropertyBlock(props); |
| 0 | 29 | | props.SetColor(ShaderUtils.BaseColor, highLightColor); |
| 0 | 30 | | objectRenderer.SetPropertyBlock(props); |
| 0 | 31 | | } |
| | 32 | |
|
| | 33 | | public void SetColorDefault() |
| | 34 | | { |
| 0 | 35 | | if (props == null) |
| 0 | 36 | | return; |
| | 37 | |
|
| 0 | 38 | | objectRenderer.GetPropertyBlock(props); |
| 0 | 39 | | props.SetColor(ShaderUtils.BaseColor, defaultColor); |
| 0 | 40 | | objectRenderer.SetPropertyBlock(props); |
| 0 | 41 | | } |
| | 42 | |
|
| | 43 | | private void Start() |
| | 44 | | { |
| 3 | 45 | | props = new MaterialPropertyBlock(); |
| 3 | 46 | | objectRenderer.GetPropertyBlock(props); |
| 3 | 47 | | props.SetColor(ShaderUtils.BaseColor, defaultColor); |
| 3 | 48 | | objectRenderer.SetPropertyBlock(props); |
| 3 | 49 | | } |
| | 50 | | } |