public static RTSBuilding Deserialize(BinaryReader s, RTSTeam team, out int?target) { int type = s.ReadInt32(); RTSBuilding e = team.AddBuilding(type, Vector2.Zero); if (e == null) { throw new Exception("Could Not Create A Building That Was Previously Created"); } e.UUID = s.ReadInt32(); e.State = s.ReadInt32(); e.ViewDirection = s.ReadVector2(); e.GridPosition = s.ReadVector2(); e.Height = s.ReadSingle(); if (s.ReadBoolean()) { target = s.ReadInt32(); } else { target = null; } e.Health = s.ReadInt32(); for (int i = 0; i < GameState.MAX_PLAYERS; i++) { e.viewedInfo.Set(i, s.ReadBoolean()); } if (s.ReadBoolean()) { if (e.ActionController != null) { e.ActionController.Deserialize(s); } } else { e.ActionController = null; } return(e); }
public static RTSBuilding Deserialize(BinaryReader s, RTSTeam team, out int? target) { int type = s.ReadInt32(); RTSBuilding e = team.AddBuilding(type, Vector2.Zero); if(e == null) throw new Exception("Could Not Create A Building That Was Previously Created"); e.UUID = s.ReadInt32(); e.State = s.ReadInt32(); e.ViewDirection = s.ReadVector2(); e.GridPosition = s.ReadVector2(); e.Height = s.ReadSingle(); if(s.ReadBoolean()) { target = s.ReadInt32(); } else { target = null; } e.Health = s.ReadInt32(); for(int i = 0; i < GameState.MAX_PLAYERS; i++) { e.viewedInfo.Set(i, s.ReadBoolean()); } if(s.ReadBoolean()) { if(e.ActionController != null) e.ActionController.Deserialize(s); } else { e.ActionController = null; } return e; }