示例#1
0
    public GameObject SetObjectiveRef(int objectiveInt, GameObject spot)
    {
        GameObject returnObj    = null;
        Gasoline   objGasoline  = null;
        Generator  objGenerator = null;
        Objective  objective    = new Objective();

        switch (objectiveInt)
        {
        case 1:
            objective.condition        = Condition.KillEnemy;
            objective.objectiveMessage = killMessage;
            break;

        case 2:
            objective.condition        = Condition.GetGasCan;
            objGasoline                = Instantiate(gasolineObject, spot.transform.position, gasolineObject.transform.rotation).GetComponent <Gasoline>();
            returnObj                  = objGasoline.gameObject;
            objective.objectiveMessage = gasMessage;

            break;

        case 3:
            objective.condition        = Condition.FindGenerator;
            objGenerator               = Instantiate(generatorObject, spot.transform.position, generatorObject.transform.rotation).GetComponent <Generator>();
            returnObj                  = objGenerator.gameObject;
            objective.objectiveMessage = generatorMessage;
            break;

        case 4:
            //objective.condition = Condition.KillEnemy;
            objective.objectiveMessage = finalMessage;
            break;

        default:
            break;
        }

        if (objective.objectiveMessage == mainObjective.objectiveMessage)
        {
            mainObjective.numTimes++;
            objectiveCount++;
        }
        else
        {
            objective.numTimes = 1;
            objectiveCount     = 1;
            mainObjective      = objective;
        }

        UpdateObjectiveText();

        return(returnObj);
    }
示例#2
0
        public void Update(double delta)
        {
            UpdateCurrentStroke();

            if (current_stroke == StrokeCycle.Combustion)
            {
                piston.force_on_piston = Gasoline.CombustionEnergyReleasedJoules(mass_of_air / 14.7, mass_of_air)
                                         / es.stroke * es.efficiency;
            }

            piston.Update(delta);
        }
示例#3
0
        public void Should_Show_Message_With_Name_And_Speed_When_Speedup_Given_Engine_A()
        {
            // given
            var expectedResult = "car: speed up 30 km/h";
            var gaslineEngine  = new Gasoline();
            var car            = new Car("car", gaslineEngine.GetSpeed());

            // when
            var actual = car.SpeedUp();

            // then
            Assert.Equal(expectedResult, actual);
        }
示例#4
0
        /// <summary>
        /// 加载gasoline代码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //获取GIInfo
            system_outputbox.Text += "Gasoline for GTWPF version " + GIInfo.GIVersion.ToString() + Environment.NewLine;


            WPFLib._function_Thread_override_.Load();
            Gasoline.StartGas(new System.Collections.Generic.Dictionary <string, GI.Lib.ILib> {
                { "IO", new WPFLib.IO_Lib() },
                { "Page", new WPFLib.Page_Lib() },
                { "Control", new WPFLib.Control_Lib() }
            });
            Gasoline.StartMain();
        }
示例#5
0
        public static void Launch_Composite()
        {
            Composite.Client client = new Composite.Client();

            Gasoline leaf  = new Gasoline();
            Electric leaf2 = new Electric();

            Composite.Composite branch1 = new Composite.Composite();
            branch1.Add(new Electric());
            branch1.Add(new Gasoline());
            Composite.Composite branch2 = new Composite.Composite();
            branch2.Add(new Gas());
            branch2.Add(new Gasoline());

            Component        auto       = new Gas();
            Component        auto2      = new Gasoline();
            List <Component> list_auto2 = new List <Component>();

            list_auto2.Add(auto);
            list_auto2.Add(auto2);
            list_auto2.Add(auto);
            list_auto2.Add(auto);


            List <Component> list_auto = new List <Component>();

            list_auto.Add(leaf);
            list_auto.Add(leaf2);
            list_auto.Add(branch1);
            list_auto.Add(branch2);
            Console.WriteLine("\nАвтосалон A имеет автомобиль:");
            client.ClientCode(list_auto);

            Console.WriteLine("\nАвтосалон B имеет автомобиль:");
            client.ClientCode(list_auto2);
        }
示例#6
0
 public Car()
 {
     tank = new Gasoline();
 }
示例#7
0
 public void tankUp(Gasoline gas)
 {
     this.isCharged = true;
 }