示例#1
0
        public UserTransformableGhost CreateGhost(UserTransformableRecordable target)
        {
            GameObject ghostObject = GameObject.Instantiate(target, target.transform.parent).gameObject;

            ghostObject.transform.localPosition = localPosition;
            ghostObject.transform.localRotation = localRotation;

            OutputText.instance.text = OutputText.instance.text + localPosition.ToString("F3") + localRotation.ToString("F3") + "\n";

            ghostObject.GetComponent <UserTransformableRecordable>().enabled = false;

            if (ghostObject.GetComponent <UserTransformableGhost>() == null)
            {
                ghostObject.AddComponent <UserTransformableGhost>();
            }
            OutputText.instance.text = OutputText.instance.text + "point1\n";
            UserTransformableGhost ghost = ghostObject.GetComponent <UserTransformableGhost>();

            ghost.enabled            = true;
            OutputText.instance.text = OutputText.instance.text + "point2\n";
            ghost.GhostifyRenderer();
            ghost.BindKeyframe(this);

            return(ghost);
        }
示例#2
0
        public void CreateSnapshot(Transform desiredTransform)
        {
            UserTransformKeyframe  keyframe = recording.AddKeyframe(desiredTransform);
            UserTransformableGhost ghost    = keyframe.CreateGhost(target);

            ghosts.Add(ghost);
            IncorporateGhost(ghosts.Count - 1);
        }
示例#3
0
        void IncorporateGhost(int index)
        {
            UserTransformableGhost ghost = ghosts[index];

            if (index > 0)
            {
                UserTransformableGhost prevGhost = ghosts[index - 1];
                prevGhost.MakePredecessorTo(ghost);
                ghost.MakeSuccessorTo(prevGhost);
            }
            if (index < ghosts.Count - 1)
            {
                UserTransformableGhost nextGhost = ghosts[index + 1];
                ghost.MakePredecessorTo(nextGhost);
                nextGhost.MakeSuccessorTo(ghost);
            }
        }
示例#4
0
 public void MakeSuccessorTo(UserTransformableGhost newPredecessor)
 {
     predecessor = newPredecessor;
     if (predecessor == null)
     {
         if (arrow != null)
         {
             Destroy(arrow);
             arrow = null;
         }
     }
     else
     {
         if (arrow == null)
         {
             arrow = Instantiate(arrowPrefab, gameObject.transform.parent);
         }
         arrow.FromTo(newPredecessor.gameObject, gameObject);
     }
 }
示例#5
0
        public void DeleteSnapshot(GameObject objectToDelete)
        {
            UserTransformableGhost ghost = objectToDelete.GetComponent <UserTransformableGhost>();

            if (ghost == null)
            {
                return;
            }

            int index = ghosts.FindIndex(delegate(UserTransformableGhost g) { return(g == ghost); });

            if (index < 0)
            {
                return;
            }

            if (index > 0)
            {
                ghost.MakeSuccessorTo(null);
                if (index < ghosts.Count - 1)
                {
                    ghosts[index - 1].MakePredecessorTo(ghosts[index + 1]);
                    ghosts[index + 1].MakeSuccessorTo(ghosts[index - 1]);
                }
                else
                {
                    ghosts[index - 1].MakePredecessorTo(null);
                }
            }
            else if (index < ghosts.Count - 1)
            {
                ghost.MakePredecessorTo(null);
                ghosts[index + 1].MakeSuccessorTo(null);
            }

            ghosts.RemoveAt(index);
            recording.RemoveKeyframe(index);

            UnityEngine.Object.Destroy(objectToDelete);
        }
示例#6
0
 public void MakePredecessorTo(UserTransformableGhost newSuccessor)
 {
     successor = newSuccessor;
 }