public override void Deserialize(NetworkReader reader) { Vector2?position = null; var hasNewPosition = reader.ReadBoolean(); if (hasNewPosition) { position = reader.ReadVector2(); } Direction?orientation = null; var hasNewOrientation = reader.ReadBoolean(); if (hasNewOrientation) { orientation = DirectionIO.readDirectionFromBuffer(reader); } var bullets = new HashSet <BulletState>(); var numBullet = reader.ReadInt32(); for (var i = 0; i < numBullet; i++) { var bullet = new BulletState(); bullet.Deserialize(reader); bullets.Add(bullet); } NewPosition = position; NewOrientation = orientation; BulletsCreated = bullets; }
public override void Deserialize(NetworkReader reader) { Position = reader.ReadVector2(); Direction = DirectionIO.readDirectionFromBuffer(reader); BulletID = reader.ReadString(); }
public override void Deserialize(NetworkReader reader) { Position = reader.ReadVector2(); Orientation = DirectionIO.readDirectionFromBuffer(reader); HP = reader.ReadSingle(); }