Exemplo n.º 1
0
        public void Clone(IWorld iWorld, bool doChecksum)
        {
            World world = (World)iWorld;

            this.Reset();
            if (doChecksum)
            {
                this.checksum = ChecksumExtractor.GetEncodedChecksum();
            }
            this.clonedPhysics.Clear();
            foreach (RigidBody rigidBody in world.RigidBodies)
            {
                RigidBodyClone @new = WorldClone.poolRigidBodyClone.GetNew();
                @new.Clone(rigidBody);
                this.clonedPhysics.Add(rigidBody.GetInstance(), @new);
            }
            this.clonedArbiters.Clear();
            foreach (Arbiter current in world.ArbiterMap.Arbiters)
            {
                ArbiterClone new2 = WorldClone.poolArbiterClone.GetNew();
                new2.Clone(current);
                this.clonedArbiters.Add(new2);
            }
            this.clonedArbitersTrigger.Clear();
            foreach (Arbiter current2 in world.ArbiterTriggerMap.Arbiters)
            {
                ArbiterClone new3 = WorldClone.poolArbiterClone.GetNew();
                new3.Clone(current2);
                this.clonedArbitersTrigger.Add(new3);
            }
            this.collisionIslands.Clear();
            this.index  = 0;
            this.length = world.islands.Count;
            while (this.index < this.length)
            {
                CollisionIsland      ci   = world.islands[this.index];
                CollisionIslandClone new4 = WorldClone.poolCollisionIslandClone.GetNew();
                new4.Clone(ci);
                this.collisionIslands.Add(new4);
                this.index++;
            }
            this.cloneCollision.Clone((CollisionSystemPersistentSAP)world.CollisionSystem);
            this.clonedInitialCollisions.Clear();
            this.clonedInitialCollisions.AddRange(world.initialCollisions);
            this.clonedInitialTriggers.Clear();
            this.clonedInitialTriggers.AddRange(world.initialTriggers);
            this.rigidBodyInstanceCount  = RigidBody.instanceCount;
            this.constraintInstanceCount = Constraint.instanceCount;
        }
Exemplo n.º 2
0
 public void Clone(IWorld iWorld, bool doChecksum)
 {
     TrueSync.Physics2D.World world = (TrueSync.Physics2D.World)iWorld;
     this.Reset();
     if (doChecksum)
     {
         this.checksum = ChecksumExtractor.GetEncodedChecksum();
     }
     this.clonedPhysics.Clear();
     this.index  = 0;
     this.length = world.BodyList.Count;
     while (this.index < this.length)
     {
         Body        body = world.BodyList[this.index];
         BodyClone2D @new = WorldClone2D.poolRigidBodyClone.GetNew();
         @new.Clone(body);
         this.clonedPhysics.Add(body.BodyId, @new);
         this.index++;
     }
     this.contactsClone.Clear();
     this.index  = 0;
     this.length = world.ContactList.Count;
     while (this.index < this.length)
     {
         TrueSync.Physics2D.Contact contact = world.ContactList[this.index];
         ContactClone2D             new2    = WorldClone2D.poolContactClone.GetNew();
         new2.Clone(contact);
         this.contactsClone.Add(new2);
         this.index++;
     }
     this.islandClone.Clone(world.Island);
     this.toiClone.Clone(world._input);
     this.dynamicTreeClone.Clone((DynamicTreeBroadPhase)world.ContactManager.BroadPhase);
     this._worldHasNewFixture = world._worldHasNewFixture;
     this.bodyCounter         = Body._bodyIdCounter;
     this.fixtureCounter      = Fixture._fixtureIdCounter;
 }
Exemplo n.º 3
0
 protected override string GetChecksumForSyncedInfo()
 {
     return(ChecksumExtractor.GetEncodedChecksum());
 }
Exemplo n.º 4
0
        // UTILS

        private string GetChecksum(bool i_Plain)
        {
            return(ChecksumExtractor.GetEncodedChecksum());
        }
 internal string GetChecksum(bool plain)
 {
     return(ChecksumExtractor.GetEncodedChecksum());
 }