Beispiel #1
0
        void OnSceneGUI()
        {
            AttachmentPoints ap = (AttachmentPoints)target;

            GUIStyle style = new GUIStyle();

            style.alignment        = TextAnchor.UpperCenter;
            style.normal.textColor = labelColor;

            PointsDict copy = new PointsDict();

            ap.Points.CopyTo(copy);

            Vector2 pos = ap.transform.position;

            foreach (var kvp in copy)
            {
                Handles.color = moveHandleColor;
                Vector2 point  = kvp.Value + pos;
                Vector2 newPos = Handles.FreeMoveHandle(point, Quaternion.identity, handleSize, Vector2.zero, Handles.CylinderHandleCap);

                Handles.Label(point, kvp.Key.ToString(), style);

                if (point != newPos)
                {
                    Undo.RecordObject(ap, "Move point");
                    ap.Points[kvp.Key] = newPos - pos;
                }
            }
        }
Beispiel #2
0
        protected override void Awake()
        {
            base.Awake();

            _attachments = GetComponent <AttachmentPoints>();
            _attachments.Points.TryGetValue("Foot", out footPoint);
            weapon     = GetComponentInChildren <Weapon>();
            moveByPath = GetComponent <MoveByPath>();
        }