Exemple #1
0
        /// <summary>
        /// Updates the muscle that is currently being placed to end at the
        /// specified position
        /// </summary>
        public void UpdateCurrentMuscleEnd(Vector3 endPoint, Bone hoveringBone)
        {
            if (currentMuscle != null)
            {
                // Check if user is hovering over an ending joint which is not the same as the starting
                // joint of the currentMuscle
                var endingPoint = endPoint;

                if (hoveringBone != null)
                {
                    if (!hoveringBone.Equals(currentMuscle.startingBone))
                    {
                        endingPoint = hoveringBone.Center;
                        currentMuscle.endingBone = hoveringBone;
                        var oldData = currentMuscle.MuscleData;
                        var newData = new MuscleData(
                            oldData.id, oldData.startBoneID, hoveringBone.BoneData.id,
                            oldData.strength, oldData.canExpand
                            );
                        currentMuscle.MuscleData = newData;
                    }
                    else
                    {
                        currentMuscle.endingBone = null;
                    }
                }
                else
                {
                    currentMuscle.endingBone = null;
                }

                currentMuscle.SetLinePoints(currentMuscle.startingBone.Center, endingPoint);
            }
        }