Пример #1
0
        // Add Car Component to the gameObject
        public static Car CreateComponent(GameObject agent_obj, CarVariation parameter1)
        {
            Car myC = agent_obj.AddComponent <Car>();

            myC.variation = parameter1;

            return(myC);
        }
Пример #2
0
        private void LoadMetadata(SpecDB db)
        {
            if (TableName.StartsWith("CAR_NAME_"))
            {
                string locale = TableName.Split('_')[2];
                if (locale.Equals("ALPHABET") || locale.Equals("JAPAN"))
                {
                    locale = "UnistrDB.sdb";
                }
                else
                {
                    locale += "_StrDB.sdb";
                }

                TableMetadata = new CarName(db.SpecDBFolderType, locale);
            }
            else if (TableName.StartsWith("CAR_VARIATION_"))
            {
                string locale = TableName.Split('_')[2];
                if (locale.Equals("ALPHABET") || locale.Equals("JAPAN"))
                {
                    locale = "UnistrDB.sdb";
                }
                else
                {
                    locale += "_StrDB.sdb";
                }
                TableMetadata = new CarVariation(db.SpecDBFolderType, locale);
            }
            else if (TableName.StartsWith("COURSE_NAME_"))
            {
                string locale = TableName.Split('_')[2];
                if (locale.Equals("ALPHABET") || locale.Equals("JAPAN"))
                {
                    locale = "UnistrDB.sdb";
                }
                else
                {
                    locale += "_StrDB.sdb";
                }
                TableMetadata = new CourseName(db.SpecDBFolderType, locale);
            }
            else if (TableName.StartsWith("VARIATION"))
            {
                string locale = "UnistrDB.sdb";
                if (TableName.Length > 9)
                {
                    locale = TableName.Substring(9);
                    if (!locale.Equals("ALPHABET") && !locale.Equals("JAPAN"))
                    {
                        locale += "_StrDB.sdb";
                    }
                }
                TableMetadata = new Variation(db.SpecDBFolderType, locale);
            }
            else if (TableName.StartsWith("RIDER_EQUIPMENT"))
            {
                string locale = "UnistrDB.sdb";
                if (TableName.Length > 15)
                {
                    locale = TableName.Substring(15);
                    if (!locale.Equals("ALPHABET") && !locale.Equals("JAPAN"))
                    {
                        locale += "_StrDB.sdb";
                    }
                }
                TableMetadata = new RiderEquipment(db.SpecDBFolderType, locale);
            }
            else
            {
                switch (TableName)
                {
                case "AIR_CLEANER":
                    TableMetadata = new AirCleaner(db.SpecDBFolderType); break;

                case "ALLOW_ENTRY":
                    TableMetadata = new AllowEntry(db.SpecDBFolderType); break;

                case "ARCADEINFO_NORMAL":
                case "ARCADEINFO_TUNED":
                    TableMetadata = new ArcadeInfoNormal(db.SpecDBFolderType); break;

                case "ASCC":
                    TableMetadata = new ASCC(db.SpecDBFolderType); break;

                case "BRAKE":
                    TableMetadata = new Brake(db.SpecDBFolderType); break;

                case "BRAKECONTROLLER":
                    TableMetadata = new BrakeController(db.SpecDBFolderType); break;

                case "CATALYST":
                    TableMetadata = new Catalyst(db.SpecDBFolderType); break;

                case "CLUTCH":
                    TableMetadata = new Clutch(db.SpecDBFolderType); break;

                case "COMPUTER":
                    TableMetadata = new Computer(db.SpecDBFolderType); break;

                case "COURSE":
                    TableMetadata = new Course(db.SpecDBFolderType); break;

                case "CAR_CUSTOM_INFO":
                    TableMetadata = new CarCustomInfo(db.SpecDBFolderType); break;

                case "DEFAULT_PARAM":
                    TableMetadata = new DefaultParam(db.SpecDBFolderType); break;

                case "DEFAULT_PARTS":
                    TableMetadata = new DefaultParts(db.SpecDBFolderType); break;

                case "DISPLACEMENT":
                    TableMetadata = new Displacement(db.SpecDBFolderType); break;

                case "DRIVETRAIN":
                    TableMetadata = new Drivetrain(db.SpecDBFolderType); break;

                case "ENGINE":
                    TableMetadata = new Engine(db.SpecDBFolderType); break;

                case "EXHAUST_MANIFOLD":
                    TableMetadata = new ExhaustManifold(db.SpecDBFolderType); break;

                case "FLYWHEEL":
                    TableMetadata = new Flywheel(db.SpecDBFolderType); break;

                case "GEAR":
                    TableMetadata = new Gear(db.SpecDBFolderType); break;

                case "MAKER":
                    TableMetadata = new Maker(db.SpecDBFolderType); break;

                case "MODEL_INFO":
                    TableMetadata = new ModelInfo(db.SpecDBFolderType); break;

                case "PAINT_COLOR_INFO":
                    TableMetadata = new PaintColorInfo(db.SpecDBFolderType); break;

                case "GENERIC_CAR":
                    TableMetadata = new GenericCar(db.SpecDBFolderType); break;

                case "FRONTTIRE":
                    TableMetadata = new FrontTire(db.SpecDBFolderType); break;

                case "REARTIRE":
                    TableMetadata = new RearTire(db.SpecDBFolderType); break;

                case "RACINGMODIFY":
                    TableMetadata = new RacingModify(db.SpecDBFolderType); break;

                case "CHASSIS":
                    TableMetadata = new Chassis(db.SpecDBFolderType); break;

                case "INTAKE_MANIFOLD":
                    TableMetadata = new IntakeManifold(db.SpecDBFolderType); break;

                case "LIGHTWEIGHT":
                    TableMetadata = new Lightweight(db.SpecDBFolderType); break;

                case "LSD":
                    TableMetadata = new Lsd(db.SpecDBFolderType); break;

                case "MUFFLER":
                    TableMetadata = new Muffler(db.SpecDBFolderType); break;

                case "NATUNE":
                    TableMetadata = new Natune(db.SpecDBFolderType); break;

                case "NOS":
                    TableMetadata = new NOS(db.SpecDBFolderType); break;

                case "PROPELLERSHAFT":
                    TableMetadata = new PropellerShaft(db.SpecDBFolderType); break;

                case "RACE":
                    TableMetadata = new Race(db.SpecDBFolderType); break;

                case "STEER":
                    TableMetadata = new Steer(db.SpecDBFolderType); break;

                case "SUPERCHARGER":
                    TableMetadata = new Supercharger(db.SpecDBFolderType); break;

                case "SUSPENSION":
                    TableMetadata = new Suspension(db.SpecDBFolderType); break;

                case "TIRECOMPOUND":
                    TableMetadata = new TireCompound(db.SpecDBFolderType); break;

                case "TURBINEKIT":
                    TableMetadata = new TurbineKit(db.SpecDBFolderType); break;

                case "GENERIC_ITEMS":
                    TableMetadata = new GenericItems(db.SpecDBFolderType); break;

                case "TUNED_CARS":
                    TableMetadata = new TunedCars(db.SpecDBFolderType); break;

                case "TUNER":
                    TableMetadata = new Tuner(db.SpecDBFolderType); break;

                case "WHEEL":
                    TableMetadata = new Wheel(db.SpecDBFolderType); break;

                // Unmapped, but havent seen having rows
                case "TCSC":
                    TableMetadata = new TCSC(db.SpecDBFolderType); break;

                case "TIREFORCEVOL":
                    TableMetadata = new TireForceVol(db.SpecDBFolderType); break;

                case "GENERIC_CAR_INFO":
                    TableMetadata = new GenericCarInfo(db.SpecDBFolderType); break;

                case "INDEP_THROTTLE":
                    TableMetadata = new IndepThrottle(db.SpecDBFolderType); break;

                case "INTERCOOLER":
                    TableMetadata = new Intercooler(db.SpecDBFolderType); break;

                case "PORTPOLISH":
                    TableMetadata = new PortPolish(db.SpecDBFolderType); break;

                case "WING":
                    TableMetadata = new Wing(db.SpecDBFolderType); break;

                case "TUNER_LIST":
                    TableMetadata = new TunerList(db.SpecDBFolderType); break;

                case "TIRESIZE":
                    TableMetadata = new TireSize(db.SpecDBFolderType); break;

                case "ENEMY_CARS":
                    TableMetadata = new EnemyCars(db.SpecDBFolderType); break;

                case "ENGINEBALANCE":
                    TableMetadata = new EngineBalance(db.SpecDBFolderType); break;

                case "RIDER_SET_ASSIGN":
                    TableMetadata = new RiderSetAssign(db.SpecDBFolderType); break;

                case "RIDER_SET":
                    TableMetadata = new RiderSet(db.SpecDBFolderType); break;

                default:
                    throw new NotSupportedException($"This table ({TableName}) is not yet mapped.");
                }

                for (int i = 0; i < TableMetadata.Columns.Count; i++)
                {
                    TableMetadata.Columns[i].ColumnIndex = i;
                }
            }
        }