Example #1
0
 private static bool LoadWinds(Dictionary <int, WindInfo> Winds)
 {
     int[] windID = WindMgr.WindID;
     for (int i = 0; i < windID.Length; i++)
     {
         int      num      = windID[i];
         WindInfo windInfo = new WindInfo();
         byte[]   array    = WindMgr.CreateVane(WindMgr.fontWind[num]);
         if (array == null || array.Length <= 0)
         {
             if (WindMgr.log.IsErrorEnabled)
             {
                 WindMgr.log.Error("Load Wind Error!");
             }
             return(false);
         }
         windInfo.WindID  = num;
         windInfo.WindPic = array;
         if (!Winds.ContainsKey(num))
         {
             Winds.Add(num, windInfo);
         }
     }
     return(true);
 }
Example #2
0
 private void Awake()
 {
     Wind = new WindInfo
     {
         Direction = Vector2.up,
         Strength  = 1
     };
 }
Example #3
0
        private async void updateWind(object sender, EventArgs e)
        {
            WindService service = new WindService();
            WindInfo    x       = await service.getCurrentWindInfo();

            strength.Text  = x.strength.ToString();
            windImg.Source = x.icon;
            await windImg.RotateTo(90 + x.direction);
        }
Example #4
0
        public WindModifier(ModifierInfo info, Entity casterEntity, Entity targetEntity, Environment environment,
                            CollectionOfInteractions modifierInteractionCollection) : base(info, casterEntity, targetEntity, environment, modifierInteractionCollection)
        {
            this.info = (WindInfo)info;

            targetMovementComponent = targetEntity.GetComponent <MovementComponent>();
            casterMovementComponent = casterEntity.GetComponent <MovementComponent>();
            duration = this.info.Wmc.ShowDurationInSeconds();
        }
Example #5
0
 /**
  * Updates the wind icon using the given information
  * windInfo : information about the wind
  */
 public async Task UpdateWindServiceUI(WindInfo windInfo)
 {
     try
     {
         forceVent.Text = windInfo.strength + " km/h";
         await windImg.RotateTo(90 + windInfo.direction);
     }
     catch (Exception e)
     {
     }
 }
Example #6
0
 public void UpdateStatistic(WeatherStationLocation location, WindInfo data)
 {
     if (location == WeatherStationLocation.In)
     {
         _statisticInBuilding.UpdateStatistic(data);
         Console.WriteLine($"Location: in building");
         PrintStatistic(_statisticInBuilding);
     }
     else
     {
         _statisticOutBuilding.UpdateStatistic(data);
         Console.WriteLine($"Location: out building");
         PrintStatistic(_statisticOutBuilding);
     }
 }
 public CommonWeatherDto(OpenWeatherMapDto input)
 {
     Source      = "OpenWeatherMap.org";
     Temperature = input?.Main?.Temp;
     Pressure    = input?.Main?.Pressure;
     Humidity    = input?.Main?.Humidity;
     Description = input?.Weather?[0].Description;
     if (input != null && input.Wind != null)
     {
         Wind = new WindInfo
         {
             Direction = input.Wind.Deg,
             Speed     = input.Wind.Speed
         }
     }
     ;
 }
        public virtual void UpdateStatistic(WindInfo windInfo)
        {
            Vector2 windVector = GetVectorByWind(windInfo.WindDirection, windInfo.WindSpeed);

            Vector2 resultVector;

            if (AverageMeasurement != null)
            {
                resultVector = Vector2.Add(_lastWindVector, windVector);
            }
            else
            {
                resultVector = windVector;
            }

            _lastWindVector = resultVector;
        }
     public CommonWeatherDto(AccuWeatherDto input)
     {
         Source      = "Accuweather.com";
         Temperature = input?.Temperature?.Metric?.Value;
         Pressure    = input?.Pressure?.Metric?.Value;
         Humidity    = input?.RelativeHumidity;
         Description = input.WeatherText;
         if (input.Wind != null)
         {
             Wind = new WindInfo
             {
                 Direction = input.Wind.Direction.Degrees,
                 Speed     = input.Wind.Speed.Metric.Value * 1000.0 / 60.0 / 60.0
             }
         }
         ;
     }
 }
        public CommonWeatherDto(WeatherbitDto input)
        {
            var data = input?.Data?[0];

            Source      = "Weatherbit.io";
            Temperature = data?.Temp;
            Pressure    = data?.Pres;
            Humidity    = data?.Rh;
            Description = data?.Weather?.Description;
            if (data != null)
            {
                Wind = new WindInfo
                {
                    Direction = data.Wind_dir,
                    Speed     = data.Wind_spd
                }
            }
            ;
        }
Example #11
0
    public void Init(int size)
    {
        TicksPerHour = (float)TicksPerYear / (365 * 24);
        int secondsPerYear = 365 * 24 * 60 * 60;

        TicksPerSecond = (float)TicksPerYear / secondsPerYear;
        SecondsPerTick = 1.0f / TicksPerSecond;

        windInfo = new WindInfo[size];

        canopyGrowthRate /= TicksPerYear;
        canopyDeathRate  /= TicksPerYear;


        InverseMetersPerTile = 1.0f / MetersPerTile;

        EvapTemperatureRange      = EvapMaxTemperature - EvapMinTemperature;
        SpecificGasConstantDryAir = UniversalGasConstant / MolarMassEarthAir;
        PressureExponent          = GravitationalAcceleration / (UniversalGasConstant * TemperatureLapseRate);

        DryAirAdiabaticLapseRate = AdiabaticLapseRate / SpecificHeatAtmosphere;

        for (int y = 0; y < size; y++)
        {
            float latitude    = ((float)y / size) * 2 - 1.0f;
            float yaw         = (float)(latitude * Math.PI * 1.5f);
            float pitch       = (float)(latitude * Math.PI * 3f);
            float absSinPitch = (float)(Math.Abs(Math.Sin(pitch)));
            float cosYaw      = (float)Math.Cos(yaw);
            float cosPitch    = (float)Math.Cos(pitch);

            float tropopauseElevation = (1.0f - Math.Abs(latitude)) * (MaxTropopauseElevation - MinTropopauseElevation) + MinTropopauseElevation + TropopauseElevationSeason * latitude;
            windInfo[y] = new WindInfo()
            {
                latitude = latitude,
                yaw      = yaw,
                tropopauseElevationMax = tropopauseElevation,
                coriolisParam          = Mathf.Sin(latitude * Mathf.PI / 2),
                inverseCoriolisParam   = 1.0f / Mathf.Sin(latitude * Mathf.PI / 2)
            };
        }
    }
        public WindInfo GetWindInfo(string postalcode)
        {
            WindInfo info = new WindInfo(WindDirection.Northwest, "12km/h");

            return(info);
        }
Example #13
0
        /**
         * This method is executed when the page is loaded
         * */
        async protected override void OnAppearing()
        {
            base.OnAppearing();
            if (holFini == 0)
            {
                return;
            }

            //if there is still a hole to play
            if (partie.nextHole() && holFini != 2)//holFini == 2 means the user wants to stop the game before the end
            {
                updateScore();
                loadCard();
                Hole nextHole = partie.getNextHole();
                map.setHolePosition(nextHole);
                numcoup.Text = partie.getCurrentHoleNumero() + "";
                parTrou.Text = "PAR " + partie.getNextHole().Par.ToString();
                MyPosition position = new MyPosition(0, 0);
                //make sure that the GPS is avaible
                try
                {
                    position = await localize();

                    map.setUserPosition(position, partie.Shots.Count);
                    partie.CurrentClub = partie.CurrentClub;//just to update the circle
                }
                catch (Exception e)
                {
                    await DisplayAlert("Gps non disponible", "La localisation GPS n'est pas disponible, assurez-vous de l'avoir activé.", "OK");

                    await Navigation.PopToRootAsync();//come back to root to avoid any problems in the game flow
                }

                updateDistance(true);

                //manage the wind icon
                try
                {
                    WindService service = new WindService();
                    await Task.Run(async() =>
                    {
                        WindInfo windInfo = await service.getCurrentWindInfo(map.getUserPosition());
                        Device.BeginInvokeOnMainThread(async() =>
                        {
                            await UpdateWindServiceUI(windInfo);
                        });
                    });
                }
                catch (Exception e)
                {
                    await DisplayAlert("Vent non disponible", "L'information concernant le vent n'est pas disponible", "OK");
                }
            }
            else  //user wants to stop the game
            {
                await Navigation.PushAsync(new GameFinishedPage(partie));

                return;
            }
            holFini = 0;
        }
Example #14
0
 public void UpdateStatistic(WindInfo data)
 {
     _info.UpdateStatistic(data);
 }