/**
     * Checks to see if the current bone is valid (attached to two joints) and if so
     * adds it to the list of bones.
     */
    private void PlaceCurrentBone()
    {
        if (currentBone == null)
        {
            return;
        }

        if (currentBone.endingJoint == null || GetHoveringObject <Joint>(joints) == null || currentBone.endingJoint.Equals(currentBone.startingJoint))
        {
            // The connection has no connected ending -> Destroy
            Destroy(currentBone.gameObject);
        }
        else
        {
            currentBone.ConnectToJoints();
            bones.Add(currentBone);

            ResetCurrentCreatureName();             // The creature was modified
        }

        currentBone = null;
    }
Example #2
0
        /// <summary>
        /// Checks to see if the current bone is valid (attached to two joints) and if so
        /// adds it to the list of bones.
        /// </summary>
        /// <returns>Returns whether the current bone was placed.</returns>
        public bool PlaceCurrentBone()
        {
            if (currentBone == null)
            {
                return(false);
            }

            if (currentBone.endingJoint == null ||
                currentBone.endingJoint.Equals(currentBone.startingJoint))
            {
                // The connection has no connected ending -> Destroy
                UnityEngine.Object.Destroy(currentBone.gameObject);
                currentBone = null;
                return(false);
            }
            else
            {
                currentBone.ConnectToJoints();
                bones.Add(currentBone);
                currentBone = null;
                // The creature was modified
                return(true);
            }
        }