コード例 #1
0
        static void Main(string[] args)
        {
            RcCar rcFull = createRcFull();

            rcFull.Color = "Green";
            rcFull.Go();
            rcFull.DisplayBatteryPower();
            rcFull.ChargeBattery();
            rcFull.PowerOnOff();
            rcFull.Go();
            rcFull.DisplayBatteryPower();
            Console.WriteLine(rcFull.ToString());

            RcCar rcReg = createRcReg();

            rcReg.Color = "Purple";
            rcReg.Go();
            rcReg.DisplayBatteryPower();
            rcReg.ChargeBattery();
            rcReg.PowerOnOff();
            Console.WriteLine(rcReg.ToString());

            RcCar rc = new RcCar();

            rc.Color = "Orange";
            rc.Go();
            rc.DisplayBatteryPower();
            rc.ChargeBattery();
            rc.PowerOnOff();
            Console.WriteLine(rc.ToString());

            Console.ReadKey();
        }
コード例 #2
0
        //static RcCar rcTwo;

        static void Main(string[] args)
        {
            rcOne = new RcCar("Sony", "Magenta", 100, true);

            Console.WriteLine(rcOne.ToString());
            rcOne.ChangeSpeed = (int)Speed.HyperSpeed;
            Console.WriteLine(rcOne.ToString());

            Console.ReadKey();
        }
コード例 #3
0
        /// <summary>
        /// used to create an instance of an RcCar object
        /// </summary>
        /// <returns></returns>
        public static RcCar createRcReg()
        {
            RcCar  rcReg;
            string model     = "JavaBuster!",
                   color     = "coffeeBean";
            decimal battLife = 100M;
            bool    isOff    = true;

            return(rcReg = new RcCar(model, color, battLife, isOff));
        }
コード例 #4
0
        /// <summary>
        /// Used to create an instance of an RcCar with alll its parameters
        /// </summary>
        /// <returns></returns>
        public static RcCar createRcFull()
        {
            RcCar  rcFull;
            string model = "littleToyCarCo",
                   color = "red";
            decimal batteryLife = 200m;
            bool    hasExtraBattery = true, isOff = true;

            return(rcFull = new RcCar(model, color, batteryLife, isOff, hasExtraBattery));
        }
コード例 #5
0
ファイル: RcController.cs プロジェクト: bigstupidx/Orby
 //Send the signal to the car
 void SendSignal()
 {
     //If the car object is not set, look for it
     if (car == null)
     {
         car = GameObject.FindObjectOfType <RcCar>();
     }
     //If we have the car, send the signal strength to it
     else
     {
         car.SetAcceloration(signalStrength);
     }
 }
コード例 #6
0
 //Send the signal to the car
 void SendSignal()
 {
     //If the car object is not set, look for it
     if (car == null)
         car = GameObject.FindObjectOfType<RcCar>();
     //If we have the car, send the signal strength to it
     else
         car.SetAcceloration(signalStrength);
 }