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