A game about forced loneliness, made by TACStudios
at master 67 lines 3.0 kB view raw
1using UnityEngine; 2 3namespace UnityEditor.U2D.Animation 4{ 5 internal enum SkeletonAction 6 { 7 None = 0, 8 Select = 1 << 0, 9 RotateBone = 1 << 2, 10 MoveBone = 1 << 3, 11 FreeMoveBone = 1 << 4, 12 MoveEndPosition = 1 << 5, 13 MoveJoint = 1 << 6, 14 ChangeLength = 1 << 7, 15 CreateBone = 1 << 8, 16 SplitBone = 1 << 9, 17 Remove = 1 << 10, 18 } 19 20 internal enum SkeletonMode 21 { 22 Disabled = SkeletonAction.None, 23 Selection = SkeletonAction.Select, 24 EditPose = Selection | SkeletonAction.RotateBone | SkeletonAction.MoveBone, 25 EditJoints = Selection | SkeletonAction.FreeMoveBone | SkeletonAction.MoveEndPosition | SkeletonAction.MoveJoint | SkeletonAction.Remove, 26 CreateBone = Selection | SkeletonAction.MoveJoint | SkeletonAction.Remove | SkeletonAction.CreateBone, 27 SplitBone = Selection | SkeletonAction.MoveEndPosition | SkeletonAction.MoveJoint | SkeletonAction.Remove | SkeletonAction.SplitBone, 28 } 29 30 internal interface ISkeletonView 31 { 32 int InvalidID { get; set; } 33 SkeletonMode mode { get; set; } 34 int defaultControlID { get; set; } 35 int hoveredBoneID { get; } 36 int hoveredJointID { get; } 37 int hoveredBodyID { get; } 38 int hoveredTailID { get; } 39 int hotBoneID { get; } 40 void BeginLayout(); 41 void EndLayout(); 42 bool CanLayout(); 43 Vector3 GetMouseWorldPosition(Vector3 planeNormal, Vector3 planePosition); 44 void LayoutBone(int id, Vector3 position, Vector3 endPosition, Vector3 forward, Vector3 up, Vector3 right, bool isChainEnd); 45 bool DoSelectBone(out int id, out bool additive); 46 bool DoRotateBone(Vector3 pivot, Vector3 normal, out float deltaAngle); 47 bool DoMoveBone(out Vector3 deltaPosition); 48 bool DoFreeMoveBone(out Vector3 deltaPosition); 49 bool DoMoveJoint(out Vector3 deltaPosition); 50 bool DoMoveEndPosition(out Vector3 endPosition); 51 bool DoChangeLength(out Vector3 endPosition); 52 bool DoCreateBoneStart(out Vector3 position); 53 bool DoCreateBone(out Vector3 position); 54 bool DoSplitBone(out int id, out Vector3 position); 55 bool DoRemoveBone(); 56 bool DoCancelMultistepAction(bool force); 57 bool IsActionActive(SkeletonAction action); 58 bool IsActionHot(SkeletonAction action); 59 bool IsActionTriggering(SkeletonAction action); 60 bool IsActionFinishing(SkeletonAction action); 61 bool IsRepainting(); 62 void DrawBone(Vector3 position, Vector3 right, Vector3 forward, float length, Color color, bool isChained, bool isSelected, bool isJointHovered, bool isTailHovered, bool isHot); 63 void DrawBoneParentLink(Vector3 parentPosition, Vector3 position, Vector3 forward, Color color); 64 void DrawBoneOutline(Vector3 position, Vector3 right, Vector3 forward, float length, Color color, float outlineScale); 65 void DrawCursors(bool canBeActive); 66 } 67}