Пример #1
0
    void AddPointToPath(int path, Vector3 point)
    {
        RootAnimation roots = (RootAnimation)target;

        roots.path.Add(point);
        roots.CreateMesh();
    }
Пример #2
0
    void OnSceneGUI()
    {
        RootAnimation roots = (RootAnimation)target;

        if (Event.current.control)
        {
            HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));
        }

        if (Event.current.control && Event.current.type == EventType.MouseDown)
        {
            Ray     ray    = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
            Vector3 hitpos = Intersect.RaycastMesh(roots.target.GetComponent <MeshFilter>().sharedMesh, roots.target.transform.position, ray);

            if (hitpos != Vector3.zero)
            {
                //AddPointToPath(0, hitpos - ray.direction * 0.7f);
            }

            RaycastHit hit = new RaycastHit();
            if (Physics.Raycast(ray, out hit, 50))
            {
                AddPointToPath(0, hit.point);
            }
        }
    }
Пример #3
0
    public override void OnInspectorGUI()
    {
        RootAnimation roots = (RootAnimation)target;

        DrawDefaultInspector();

        GUILayout.Box("Left Ctrl + Left Mouse Button - Set path point", GUILayout.ExpandWidth(true));
    }
Пример #4
0
        } // AddAnimationClip

        #endregion

        #region Remove Animation Clip

        /// <summary>
        /// Remove an animation clip to the component.
        /// </summary>
        public void RemoveAnimationClip(RootAnimation animation)
        {
            if (ContainsAnimationClip(animation))
            {
                rootAnimations.Remove(animation.Name);
            }
            else
            {
                throw new ArgumentException("Model Animation Component: The animation " + animation.Name + " does not exist.");
            }
        } // RemoveAnimationClip
Пример #5
0
        } // Uninitialize

        #endregion

        #region Contains Animation Clip

        /// <summary>
        /// Determines if the component contains a specific root animation.
        /// </summary>
        /// <remarks>Checks both, the name and the clip.</remarks>
        public bool ContainsAnimationClip(RootAnimation animation)
        {
            return(rootAnimations.ContainsValue(animation.Resource) || rootAnimations.ContainsKey(animation.Name));
        } // ContainsAnimationClip