Esempio n. 1
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);
            }
        }
Esempio n. 2
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);
        }