HandShankTouchEvent.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using SC.InputSystem.InputDeviceHandShank;
  5. using SC.InputSystem;
  6. public class HandShankTouchEvent : HandShankEventDelegate {
  7. public InputDevicePartType partType;
  8. public MeshRenderer left;
  9. public MeshRenderer right;
  10. public MeshRenderer up;
  11. public MeshRenderer down;
  12. protected override void handShankDelegate(HandShankEvent aEvent, InputDeviceHandShankPart handShankPart) {
  13. base.handShankDelegate(aEvent, handShankPart);
  14. Debug.Log("HandShankTouchEvent Part:"+ handShankPart.PartType+" Event:"+ aEvent);
  15. if(partType == handShankPart.PartType && aEvent == HandShankEvent.TouchUp) {
  16. left.materials[0].color = Color.white;
  17. right.materials[0].color = Color.white;
  18. down.materials[0].color = Color.white;
  19. up.materials[0].color = Color.white;
  20. } else if(partType == handShankPart.PartType && aEvent == HandShankEvent.TouchSlideDown) {
  21. down.materials[0].color = Color.blue;
  22. } else if(partType == handShankPart.PartType && aEvent == HandShankEvent.TouchSlideLeft) {
  23. left.materials[0].color = Color.blue;
  24. } else if(partType == handShankPart.PartType && aEvent == HandShankEvent.TouchSlideRight) {
  25. right.materials[0].color = Color.blue;
  26. } else if(partType == handShankPart.PartType && aEvent == HandShankEvent.TouchSlideUp) {
  27. up.materials[0].color = Color.blue;
  28. }
  29. }
  30. }