DragPointMune.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using UnityEngine;
  2. namespace COM3D2.MeidoPhotoStudio.Plugin
  3. {
  4. using Input = InputManager;
  5. public class DragPointMune : DragPointChain
  6. {
  7. private bool isMuneL;
  8. public override void Set(Transform myObject)
  9. {
  10. base.Set(myObject);
  11. isMuneL = myObject.name[5] == 'L'; // Mune_L_Sub
  12. }
  13. protected override void ApplyDragType() => ApplyProperties(CurrentDragType != DragType.None, false, false);
  14. protected override void OnMouseDown()
  15. {
  16. base.OnMouseDown();
  17. meido.SetMune(false, isMuneL);
  18. }
  19. protected override void OnDoubleClick()
  20. {
  21. if (CurrentDragType != DragType.None) meido.SetMune(true, isMuneL);
  22. }
  23. protected override void UpdateDragType()
  24. {
  25. if (Input.Control && Input.Alt) CurrentDragType = Input.Shift ? DragType.RotLocalY : DragType.RotLocalXZ;
  26. else CurrentDragType = DragType.None;
  27. }
  28. protected override void Drag()
  29. {
  30. if (isPlaying) meido.Stop = true;
  31. if (CurrentDragType == DragType.RotLocalXZ)
  32. {
  33. Porc(IK, ikCtrlData, ikChain[jointUpper], ikChain[jointMiddle], ikChain[jointLower]);
  34. InitializeRotation();
  35. }
  36. if (CurrentDragType == DragType.RotLocalY)
  37. {
  38. Vector3 mouseDelta = MouseDelta();
  39. ikChain[jointMiddle].localRotation = jointRotation[jointMiddle];
  40. ikChain[jointMiddle].Rotate(Vector3.right * (-mouseDelta.x / 1.5f));
  41. }
  42. }
  43. }
  44. }