internal override Model ReadEntry(BinaryReaderEx br) { var model = new Model(br); switch (model.Type) { case ModelType.MapPiece: MapPieces.Add(model); return(model); case ModelType.Object: Objects.Add(model); return(model); case ModelType.Collision: Collisions.Add(model); return(model); case ModelType.Navmesh: Navmeshes.Add(model); return(model); default: throw new NotImplementedException($"Unimplemented model type: {model.Type}"); } }
/// <summary> /// Adds a part to the appropriate list for its type; returns the part. /// </summary> public Part Add(Part part) { switch (part) { case Part.MapPiece p: MapPieces.Add(p); break; case Part.Object p: Objects.Add(p); break; case Part.Enemy p: Enemies.Add(p); break; case Part.Player p: Players.Add(p); break; case Part.Collision p: Collisions.Add(p); break; case Part.Protoboss p: Protobosses.Add(p); break; case Part.Navmesh p: Navmeshes.Add(p); break; case Part.DummyObject p: DummyObjects.Add(p); break; case Part.DummyEnemy p: DummyEnemies.Add(p); break; case Part.ConnectCollision p: ConnectCollisions.Add(p); break; default: throw new ArgumentException($"Unrecognized type {part.GetType()}.", nameof(part)); } return(part); }
internal override Model ReadEntry(BinaryReaderEx br) { ModelType type = br.GetEnum32 <ModelType>(br.Position + 8); switch (type) { case ModelType.MapPiece: var mapPiece = new Model.MapPiece(br); MapPieces.Add(mapPiece); return(mapPiece); case ModelType.Object: var obj = new Model.Object(br); Objects.Add(obj); return(obj); case ModelType.Enemy: var enemy = new Model.Enemy(br); Enemies.Add(enemy); return(enemy); case ModelType.Player: var player = new Model.Player(br); Players.Add(player); return(player); case ModelType.Collision: var collision = new Model.Collision(br); Collisions.Add(collision); return(collision); default: throw new NotImplementedException($"Unimplemented model type: {type}"); } }
public void Add(IMsbModel item) { var m = (Model)item; switch (m.Type) { case ModelType.MapPiece: MapPieces.Add(m); break; case ModelType.Object: Objects.Add(m); break; case ModelType.Collision: Collisions.Add(m); break; case ModelType.Navmesh: Navmeshes.Add(m); break; default: throw new ArgumentException( message: "Item is not recognized", paramName: nameof(item)); } }
internal override Model ReadEntry(BinaryReaderEx br) { ModelType type = br.GetEnum32 <ModelType>(br.Position + 8); switch (type) { case ModelType.MapPiece: return(MapPieces.EchoAdd(new Model.MapPiece(br))); case ModelType.Object: return(Objects.EchoAdd(new Model.Object(br))); case ModelType.Enemy: return(Enemies.EchoAdd(new Model.Enemy(br))); case ModelType.Item: return(Items.EchoAdd(new Model.Item(br))); case ModelType.Player: return(Players.EchoAdd(new Model.Player(br))); case ModelType.Collision: return(Collisions.EchoAdd(new Model.Collision(br))); case ModelType.Navmesh: return(Navmeshes.EchoAdd(new Model.Navmesh(br))); case ModelType.Other: return(Others.EchoAdd(new Model.Other(br))); default: throw new NotImplementedException($"Unimplemented model type: {type}"); } }
/// <summary> /// Adds a model to the appropriate list for its type; returns the model. /// </summary> public Model Add(Model model) { switch (model) { case Model.MapPiece m: MapPieces.Add(m); break; case Model.Object m: Objects.Add(m); break; case Model.Enemy m: Enemies.Add(m); break; case Model.Item m: Items.Add(m); break; case Model.Player m: Players.Add(m); break; case Model.Collision m: Collisions.Add(m); break; case Model.Navmesh m: Navmeshes.Add(m); break; case Model.Other m: Others.Add(m); break; default: throw new ArgumentException($"Unrecognized type {model.GetType()}.", nameof(model)); } return(model); }
internal override Part ReadEntry(BinaryReaderEx br) { PartType type = br.GetEnum16 <PartType>(br.Position + 8); switch (type) { case PartType.MapPiece: var mapPiece = new Part.MapPiece(br); MapPieces.Add(mapPiece); return(mapPiece); case PartType.Object: var obj = new Part.Object(br); Objects.Add(obj); return(obj); case PartType.Collision: var collision = new Part.Collision(br); Collisions.Add(collision); return(collision); case PartType.Navmesh: var navmesh = new Part.Navmesh(br); Navmeshes.Add(navmesh); return(navmesh); case PartType.ConnectCollision: var connectCollision = new Part.ConnectCollision(br); ConnectCollisions.Add(connectCollision); return(connectCollision); default: throw new NotImplementedException($"Unimplemented part type: {type}"); } }
public void Add(IMsbPart item) { switch (item) { case Part.MapPiece m: MapPieces.Add(m); break; case Part.Object m: Objects.Add(m); break; case Part.Collision m: Collisions.Add(m); break; case Part.Navmesh m: Navmeshes.Add(m); break; case Part.ConnectCollision m: ConnectCollisions.Add(m); break; default: throw new ArgumentException( message: "Item is not recognized", paramName: nameof(item)); } }
internal override Model ReadEntry(BinaryReaderEx br) { ModelType type = br.GetEnum32 <ModelType>(br.Position + 4); var model = new Model(br); if (type == ModelType.MapPiece) { MapPieces.Add(model); } else if (type == ModelType.Object) { Objects.Add(model); } else if (type == ModelType.Enemy) { Enemies.Add(model); } else if (type == ModelType.Player) { Players.Add(model); } else if (type == ModelType.Collision) { Collisions.Add(model); } else if (type == ModelType.Navmesh) { Navmeshes.Add(model); } else { throw new NotImplementedException($"Unimplemented model type: {type}"); } return(model); }
internal override Part ReadEntry(BinaryReaderEx br) { PartType type = br.GetEnum8 <PartType>(br.Position + br.VarintSize); switch (type) { case PartType.MapPiece: return(MapPieces.EchoAdd(new Part.MapPiece(br))); case PartType.Object: return(Objects.EchoAdd(new Part.Object(br))); case PartType.Collision: return(Collisions.EchoAdd(new Part.Collision(br))); case PartType.Navmesh: return(Navmeshes.EchoAdd(new Part.Navmesh(br))); case PartType.ConnectCollision: return(ConnectCollisions.EchoAdd(new Part.ConnectCollision(br))); default: throw new NotImplementedException($"Unimplemented part type: {type}"); } }
internal override Part ReadEntry(BinaryReaderEx br) { PartType type = br.GetEnum32 <PartType>(br.Position + 4); switch (type) { case PartType.MapPiece: var mapPiece = new Part.MapPiece(br); MapPieces.Add(mapPiece); return(mapPiece); case PartType.Object: var obj = new Part.Object(br); Objects.Add(obj); return(obj); case PartType.Enemy: var enemy = new Part.Enemy(br); Enemies.Add(enemy); return(enemy); case PartType.Player: var player = new Part.Player(br); Players.Add(player); return(player); case PartType.Collision: var collision = new Part.Collision(br); Collisions.Add(collision); return(collision); case PartType.Navmesh: var navmesh = new Part.Navmesh(br); Navmeshes.Add(navmesh); return(navmesh); case PartType.DummyObject: var dummyObject = new Part.DummyObject(br); DummyObjects.Add(dummyObject); return(dummyObject); case PartType.DummyEnemy: var dummyEnemy = new Part.DummyEnemy(br); DummyEnemies.Add(dummyEnemy); return(dummyEnemy); case PartType.ConnectCollision: var connectCollision = new Part.ConnectCollision(br); ConnectCollisions.Add(connectCollision); return(connectCollision); default: throw new NotImplementedException($"Unimplemented part type: {type}"); } }
internal override Part ReadEntry(BinaryReaderEx br) { PartType type = br.GetEnum32 <PartType>(br.Position + 4); switch (type) { case PartType.MapPiece: return(MapPieces.EchoAdd(new Part.MapPiece(br))); case PartType.Object: return(Objects.EchoAdd(new Part.Object(br))); case PartType.Enemy: return(Enemies.EchoAdd(new Part.Enemy(br))); case PartType.Player: return(Players.EchoAdd(new Part.Player(br))); case PartType.Collision: return(Collisions.EchoAdd(new Part.Collision(br))); case PartType.Protoboss: return(Protobosses.EchoAdd(new Part.Protoboss(br))); case PartType.Navmesh: return(Navmeshes.EchoAdd(new Part.Navmesh(br))); case PartType.DummyObject: return(DummyObjects.EchoAdd(new Part.DummyObject(br))); case PartType.DummyEnemy: return(DummyEnemies.EchoAdd(new Part.DummyEnemy(br))); case PartType.ConnectCollision: return(ConnectCollisions.EchoAdd(new Part.ConnectCollision(br))); default: throw new NotImplementedException($"Unimplemented part type: {type}"); } }