Beispiel #1
0
        public override Sphere Clone()
        {
            // Make a shell
            // I want a copy of the bounding box, not a clone (everything else gets cloned)
            RigidBodyPolygon retVal = new RigidBodyPolygon(this.Position.Clone(), this.OriginalDirectionFacing.Clone(), this.Rotation.Clone(), _polygon.ClonePolygonSyncedRotation(), this.Radius, this.Elasticity, this.KineticFriction, this.StaticFriction, this.UsesBoundingBox, this.BoundryLower, this.BoundryUpper);

            PointMass[] clonedMasses = this.PointMasses;

            // Clone them (I don't want the events to go with)
            for (int massCntr = 0; massCntr < clonedMasses.Length; massCntr++)
            {
                clonedMasses[massCntr] = clonedMasses[massCntr].Clone();
            }

            // Now I can add the masses to my return
            retVal.AddRangePointMasses(clonedMasses);

            // Exit Function
            return(retVal);
        }
Beispiel #2
0
        public override Sphere Clone()
        {
            // Make a shell
            // I want a copy of the bounding box, not a clone (everything else gets cloned)
            RigidBodyPolygon retVal = new RigidBodyPolygon(this.Position.Clone(), this.OriginalDirectionFacing.Clone(), this.Rotation.Clone(), _polygon.ClonePolygonSyncedRotation(), this.Radius, this.Elasticity, this.KineticFriction, this.StaticFriction, this.UsesBoundingBox, this.BoundryLower, this.BoundryUpper);

            PointMass[] clonedMasses = this.PointMasses;

            // Clone them (I don't want the events to go with)
            for (int massCntr = 0; massCntr < clonedMasses.Length; massCntr++)
            {
                clonedMasses[massCntr] = clonedMasses[massCntr].Clone();
            }

            // Now I can add the masses to my return
            retVal.AddRangePointMasses(clonedMasses);

            // Exit Function
            return retVal;
        }