public void Generate() { LastTick = Engine.Ticks; if (Type == 0xFF || Type == 0xFE) { return; } //int drawX = Engine.Profile.Current.GameWindowPosition.X; //int drawY = Engine.Profile.Current.GameWindowPosition.Y; if (Count > 70) { Count = 70; } WindTimer = 0; while (CurrentCount < Count) { WeatherEffect effect = new WeatherEffect() { X = RandomHelper.GetValue(0, Engine.Profile.Current.GameWindowSize.X), Y = RandomHelper.GetValue(0, Engine.Profile.Current.GameWindowSize.Y) }; Effects.Add(effect); CurrentCount++; } }
public void Generate() { LastTick = Time.Ticks; if (Type == 0xFF || Type == 0xFE) { return; } if (Count > MAX_WEATHER_EFFECT) { Count = MAX_WEATHER_EFFECT; } WindTimer = 0; while (CurrentCount < Count) { ref WeatherEffect effect = ref _effects[CurrentCount++]; effect.X = RandomHelper.GetValue(0, ProfileManager.CurrentProfile.GameWindowSize.X); effect.Y = RandomHelper.GetValue(0, ProfileManager.CurrentProfile.GameWindowSize.Y); }
public void Generate(WEATHER_TYPE type, byte count, byte temp) { if (CurrentWeather.HasValue && CurrentWeather == type) { return; } Reset(); Type = type; Count = (byte)Math.Min(MAX_WEATHER_EFFECT, (int)count); Temperature = temp; _timer = Time.Ticks + Constants.WEATHER_TIMER; _lastTick = Time.Ticks; if (Type == WEATHER_TYPE.WT_INVALID_0 || Type == WEATHER_TYPE.WT_INVALID_1) { _timer = 0; CurrentWeather = null; return; } bool showMessage = Count > 0; switch (type) { case WEATHER_TYPE.WT_RAIN: if (showMessage) { GameActions.Print ( ResGeneral.ItBeginsToRain, 1154, MessageType.System, 3, false ); CurrentWeather = type; } break; case WEATHER_TYPE.WT_FIERCE_STORM: if (showMessage) { GameActions.Print ( ResGeneral.AFierceStormApproaches, 1154, MessageType.System, 3, false ); CurrentWeather = type; } break; case WEATHER_TYPE.WT_SNOW: if (showMessage) { GameActions.Print ( ResGeneral.ItBeginsToSnow, 1154, MessageType.System, 3, false ); CurrentWeather = type; } break; case WEATHER_TYPE.WT_STORM: if (showMessage) { GameActions.Print ( ResGeneral.AStormIsBrewing, 1154, MessageType.System, 3, false ); CurrentWeather = type; } break; } _windTimer = 0; while (CurrentCount < Count) { ref WeatherEffect effect = ref _effects[CurrentCount++]; effect.X = RandomHelper.GetValue(0, ProfileManager.CurrentProfile.GameWindowSize.X); effect.Y = RandomHelper.GetValue(0, ProfileManager.CurrentProfile.GameWindowSize.Y); }