Beispiel #1
0
    private IEnumerator RestoreFuel()
    {
        yield return(new WaitForSeconds(fuelRestorationTime));

        fuel      = FUEL_MAX;
        fuelState = FuelState.replenishing;
    }
Beispiel #2
0
        public FuelState GetFuelState(string VehicleId, string access_token)
        {
            var client  = new RestClient("https://api.mercedes-benz.com/experimental/connectedvehicle/v1/vehicles/" + VehicleId + "/fuel");
            var request = new RestRequest(Method.GET);

            request.AddHeader("Authorization", "Bearer " + access_token);
            request.AddHeader("Content-Type", "application/json");
            request.AddHeader("Accept", "application/json");
            IRestResponse response = client.Execute(request);

            FuelState JSONObj = JsonConvert.DeserializeObject <FuelState>(response.Content);

            return(JSONObj);
        }
Beispiel #3
0
        public IntentExecutor(
            ILogger <IntentExecutor> logger,
            BringState bringState,
            RouteState routeState,
            SpotifyState spotifyState,
            HueState hueState,
            WeatherState weatherState,
            CalendarState calendarState,
            FuelState fuelState,
            ClockState clockState,
            VvsState vvsState,
            FitbitState fitbitState,
            GoogleFitState googleFitState,
            SoccerState bundesligaState,
            NewsState newsState)
        {
            _logger          = logger;
            _bringState      = bringState;
            _routeState      = routeState;
            _spotifyState    = spotifyState;
            _hueState        = hueState;
            _weatherState    = weatherState;
            _calendarState   = calendarState;
            _fuelState       = fuelState;
            _clockState      = clockState;
            _vvsState        = vvsState;
            _fitbitState     = fitbitState;
            _googleFitState  = googleFitState;
            _bundesligaState = bundesligaState;
            _newsState       = newsState;

            _displayableDictionary = new Dictionary <Type, Displayable>
            {
                { typeof(BringState), bringState },
                { typeof(RouteState), routeState },
                { typeof(SpotifyState), spotifyState },
                { typeof(HueState), hueState },
                { typeof(WeatherState), weatherState },
                { typeof(CalendarState), calendarState },
                { typeof(FuelState), fuelState },
                { typeof(ClockState), clockState },
                { typeof(VvsState), vvsState },
                { typeof(FitbitState), fitbitState },
                { typeof(GoogleFitState), googleFitState },
                { typeof(SoccerState), bundesligaState },
                { typeof(NewsState), newsState },
            };
        }
Beispiel #4
0
    private void Update()
    {
        if (Mathf.Approximately(fuel, FUEL_MIN))
        {
            fuelState = FuelState.empty;
        }
        switch (fuelState)
        {
        case FuelState.depleting:
            DepleteFuel();
            break;

        case FuelState.replenishing:
            ReplenishFuel();
            break;

        case FuelState.empty:
            FuelExhausted();
            break;
        }
    }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    VehicleInformation getVehicleInformation = new VehicleInformation();
                    TireStates         getTireStates         = new TireStates();
                    Location           getLocation           = new Location();
                    Odometer           getOdometer           = new Odometer();
                    FuelState          getFuelState          = new FuelState();
                    StateOfCharge      getStateOfCharge      = new StateOfCharge();
                    StateOfDoors       getStateOfDoors       = new StateOfDoors();

                    if (Request.QueryString["code"] != null)
                    {
                        string Access_token = VerifyAuthentication(Request.QueryString["code"]);
                        string VehicleId    = GetVehicleId(Access_token);
                        getVehicleInformation = GetVehicleInformationById(VehicleId, Access_token);
                        getTireStates         = GetTireState(VehicleId, Access_token);
                        getLocation           = GetLocation(VehicleId, Access_token);
                        getOdometer           = GetOdometer(VehicleId, Access_token);
                        getFuelState          = GetFuelState(VehicleId, Access_token);
                        getStateOfCharge      = GetStateOfCharge(VehicleId, Access_token);
                        getStateOfDoors       = GetStateOfDoors(VehicleId, Access_token);
                        string kapidurum = SetLockStateOfDoors(VehicleId, Access_token);
                        if (kapidurum == "INITIATED")
                        {
                        }
                        else
                        {
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Beispiel #6
0
 public void SetFuelState(FuelState newFuelState)
 {
     fuelState = newFuelState;
 }
Beispiel #7
0
    [SerializeField] private float fuelRestorationTime; // After going empty, how much time the player must wait to go back to full

    void Awake()
    {
        fuelState = FuelState.replenishing;
        fuel      = FUEL_MAX;
    }