feat: polish VR gameplay and sync tools
This commit is contained in:
@@ -15,10 +15,14 @@ namespace VRBeats
|
||||
private VR_Grabbable grabbable = null;
|
||||
private ColorSide colorSide = ColorSide.Left;
|
||||
private MeshRenderer[] renderArray = null;
|
||||
private SaberTrailEffect trailEffect = null;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
renderArray = transform.GetComponentsInChildren<MeshRenderer>();
|
||||
trailEffect = GetComponent<SaberTrailEffect>();
|
||||
if (trailEffect == null)
|
||||
trailEffect = gameObject.AddComponent<SaberTrailEffect>();
|
||||
|
||||
grabbable = GetComponent<VR_Grabbable>();
|
||||
grabbable.OnGrabStateChange.AddListener(OnGrabStateChange);
|
||||
@@ -44,6 +48,9 @@ namespace VRBeats
|
||||
{
|
||||
SetMaterialBindings(materialBindingArray[n], c);
|
||||
}
|
||||
|
||||
if (trailEffect != null)
|
||||
trailEffect.SetColor(c);
|
||||
}
|
||||
|
||||
private void SetMaterialBindings(MaterialBindings matBindings, Color c)
|
||||
@@ -55,11 +62,15 @@ namespace VRBeats
|
||||
public void MakeVisible()
|
||||
{
|
||||
SetRenderArrayEnableValue(true);
|
||||
if (trailEffect != null)
|
||||
trailEffect.SetVisible(true);
|
||||
}
|
||||
|
||||
public void MakeInvisible()
|
||||
{
|
||||
SetRenderArrayEnableValue(false);
|
||||
if (trailEffect != null)
|
||||
trailEffect.SetVisible(false);
|
||||
}
|
||||
|
||||
private void SetRenderArrayEnableValue(bool value)
|
||||
@@ -72,4 +83,4 @@ namespace VRBeats
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user