void RefreshCrosshair()
 {
     if (m_crosshair)
     {
         if (isGrabbed)
         {
             m_crosshair.SetState(GrabbableCrosshair.CrosshairState.Disabled);
         }
         else if (!InRange)
         {
             m_crosshair.SetState(GrabbableCrosshair.CrosshairState.Disabled);
         }
         else
         {
             m_crosshair.SetState(Targeted ? GrabbableCrosshair.CrosshairState.Targeted : GrabbableCrosshair.CrosshairState.Enabled);
         }
     }
     if (m_renderer != null && m_materialColorField != null)
     {
         m_renderer.GetPropertyBlock(m_mpb);
         if (isGrabbed || !InRange)
         {
             m_mpb.SetColor(m_materialColorField, Color.white);
         }
         else if (Targeted)
         {
             m_mpb.SetColor(m_materialColorField, m_crosshairManager.OutlineColorHighlighted);
         }
         else
         {
             m_mpb.SetColor(m_materialColorField, m_crosshairManager.OutlineColorInRange);
         }
         m_renderer.SetPropertyBlock(m_mpb);
     }
 }
예제 #2
0
 void RefreshCrosshair()
 {
     if (m_crosshair)
     {
         if (isGrabbed)
         {
             m_crosshair.SetState(GrabbableCrosshair.CrosshairState.Disabled);
         }
         else if (!InRange)
         {
             m_crosshair.SetState(GrabbableCrosshair.CrosshairState.Disabled);
         }
         else
         {
             m_crosshair.SetState(Targeted ? GrabbableCrosshair.CrosshairState.Targeted : GrabbableCrosshair.CrosshairState.Enabled);
         }
     }
     if (m_materialColorField != null)
     {
         m_renderer.GetPropertyBlock(m_mpb);
         if (isGrabbed || !InRange)
         {
             m_mpb.SetColor(m_materialColorField, Color.clear); // teo 31/01/2019
         }
         else
         if (Targeted)
         {
             // teo funziona solo con il proprio shader, quello del sole non va bene: deve essere unlit!
             // considerare altre possibilità
             m_mpb.SetColor(m_materialColorField, Color.green);
         }
         else
         {
             m_mpb.SetColor(m_materialColorField, Color.clear);    // m_crosshairManager.OutlineColorInRange); // teo 31/01/2019
         }
         m_renderer.SetPropertyBlock(m_mpb);
     }
 }