Example #1
0
        public CreatureStructure Clone()
        {
            var clonedStructure = new CreatureStructure();

            foreach (var joint in Joints)
            {
                var newJoint = joint.Clone();
                clonedStructure.Joints.Add(newJoint);
            }

            foreach (var bone in Bones)
            {
                var newBone = bone.Clone();
                newBone.FirstJoint  = clonedStructure.Joints.First(j => j.Tracker == bone.FirstJoint.Tracker);
                newBone.SecondJoint = clonedStructure.Joints.First(j => j.Tracker == bone.SecondJoint.Tracker);
                Debug.Assert(clonedStructure.Joints.Contains(newBone.FirstJoint));
                Debug.Assert(clonedStructure.Joints.Contains(newBone.SecondJoint));
                clonedStructure.Bones.Add(newBone);
            }

            return(clonedStructure);
        }
Example #2
0
 private Creature(CreatureStructure creatureStructure, IEnumerable <MovementPattern> movementPatterns)
 {
     MovementPatterns  = movementPatterns.ToList();
     CreatureStructure = creatureStructure;
     OnCreate();
 }