Exemple #1
0
 // restore game state
 public AIPathNode(BinaryReader inf)
 {
     ID                 = inf.ReadInt32();
     Index              = inf.ReadInt32();
     Type               = (AIPathNodeType)inf.ReadInt32();
     WaitTimeS          = inf.ReadInt32();
     WaitUntil          = inf.ReadInt32();
     NCars              = inf.ReadInt32();
     NextMainTVNIndex   = inf.ReadInt32();
     NextSidingTVNIndex = inf.ReadInt32();
     JunctionIndex      = inf.ReadInt32();
     IsFacingPoint      = inf.ReadBoolean();
     Location           = WorldLocation.Restore(inf);
 }
Exemple #2
0
        public void WorldLocationSerializationTest()
        {
            WorldLocation location1 = new WorldLocation(-17, 13, -45.3f, 62.8f, 91.7f);
            WorldLocation location2;

            using (BinaryWriter writer = new BinaryWriter(new MemoryStream()))
            {
                WorldLocation.Save(location1, writer);
                writer.BaseStream.Position = 0;
                using (BinaryReader reader = new BinaryReader(writer.BaseStream))
                    location2 = WorldLocation.Restore(reader);
            }

            Assert.IsTrue(Equals(location1, location2));
        }