Exemplo n.º 1
0
            /// <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);
            }
Exemplo n.º 2
0
            /// <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.Player m: Players.Add(m); break;

                case Model.Collision m: Collisions.Add(m); break;

                case Model.Navmesh m: Navmeshes.Add(m); break;

                case Model.DummyObject m: DummyObjects.Add(m); break;

                case Model.DummyEnemy m: DummyEnemies.Add(m); break;

                default:
                    throw new ArgumentException($"Unrecognized type {model.GetType()}.", nameof(model));
                }
                return(model);
            }
Exemplo n.º 3
0
            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}");
                }
            }
Exemplo n.º 4
0
            public void Add(IMsbPart item)
            {
                switch (item)
                {
                case Part.MapPiece m:
                    MapPieces.Add(m);
                    break;

                case Part.DummyObject m:
                    DummyObjects.Add(m);
                    break;

                case Part.Object m:
                    Objects.Add(m);
                    break;

                case Part.DummyEnemy m:
                    DummyEnemies.Add(m);
                    break;

                case Part.Enemy m:
                    Enemies.Add(m);
                    break;

                case Part.Player m:
                    Players.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));
                }
            }