コード例 #1
0
    static void Main()
    {
        Car car = new Car
        {
            Make  = "Scion",
            Model = "xD",
            Year  = 2010
        };

        Mechanic mechanic = new Mechanic();
        // Inject the dependency to Mechanic into the constructor
        AutoShop shop = new AutoShop(mechanic);

        shop.FixCar(car);

        Welder welder = new Welder();

        // Inject the dependency to Welder into the constructor
        shop = new AutoShop(welder);
        shop.FixCar(car);

        shop = new AutoShop();
        // Inject the dependency to Welder into the property
        shop.Worker = welder;
        shop.WeldCar(car);
    }
コード例 #2
0
ファイル: Program.cs プロジェクト: vicpon/Lessons
    static void Main()
    {
        AutoShop shop = new AutoShop();
        Car      car  = new Car
        {
            Make  = "Scion",
            Model = "xD",
            Year  = 2010
        };

        shop.FixCar(car);
    }
コード例 #3
0
ファイル: Program.cs プロジェクト: vicpon/Lessons
    static void Main()
    {
        Car car = new Car
        {
            Make  = "Scion",
            Model = "xD",
            Year  = 2010
        };

        Mechanic mechanic = new Mechanic();
        AutoShop shop     = new AutoShop(mechanic);

        shop.FixCar(car);

        Welder welder = new Welder();

        shop = new AutoShop(welder);
        shop.FixCar(car);
    }
コード例 #4
0
    void OnEnable()
    {
        VC = GameObject.FindWithTag("Player").GetComponent <Player>().CurrentVehicle;
        AS = VC.CurrentShop;

        TM.Init(this, VC.Config.InstallableKits, VC.MRD.KitIndex);
        HM.Init(this, Horns);
        PM.Init(this);

        PaidHornIndex = VC.MRD.HornIndex;
        PaidKitIndex  = VC.MRD.KitIndex;

        PaidPartsIndices.Clear();
        for (int i = 0; i < 3; i++)      //FRONT MIDDLE END
        {
            PaidPartsIndices.Add(VC.MRD.CurrentPartsIndices[i]);
        }

        for (int i = 0; i < VC.MRD.Colors.Count; i++)      //FRONT MIDDLE END
        {
            PaidColors[i] = VC.MRD.Colors[i];
        }
        //SubPartIndices

        /*
         * WheelMats.Add(Wheels[0].materials);
         * WheelMats.Add(Wheels[1].materials);
         * WheelMats.Add(Wheels[2].materials);
         * WheelMats.Add(Wheels[3].materials);
         *
         * WheelMats.Add(Wheels[4].materials);
         */

        /*
         * for(int i = 0; i < Colors.Length; i++)
         *  PreviewColors[i] = Colors[i];
         *
         * ApplyColors(Colors);
         */
    }