// Use this for initialization void Start() { wind = GameObject.Find("GameController").GetComponent<Wind>(); shuriken = gameObject.GetComponent<ParticleSystem>(); //transform.rotation = Quaternion.Euler(0, 0, myRotation.eulerAngles.y); }
void Awake() { // Register the singleton if (Instance != null) { Debug.LogError("Multiple instances of Wind!"); } Instance = this; }
// Use this for initialization void Start() { if (atm == null){ atm = GameObject.Find("GameController").GetComponent<Atmosphere>(); } if (wind == null){ wind = atm.gameObject.GetComponent<Wind>(); } }
// Use this for initialization void Start() { // windSpeedMin = 0; // windSpeedMax = 10; // windIntensity = .2f; windMaker = GameObject.FindGameObjectWithTag("Wind").GetComponent<Wind>(); //breatheCreate = Camera.main.GetComponent<UserBreathe>(); //micInput = Camera.main.GetComponent<MicrophoneInput> (); }
public void TestInitialize() { _field = new Field(5, 5); _tractor = new Tractor(_field); _stone = new Stone(_field); _wind = new Wind(_field); _units = new List <Unit> { _tractor, _stone, _wind }; _moveCommand = new MoveForwardCommand(_units); _turnCommand = new TurnClockwiseCommand(_units); }
void Draw(Vector2 w, GUI.WindowFunction f, Wind wnd) { if (curwindow == wnd) { w /= 2; Vector2 s = new Vector2(Screen.width, Screen.height) / 2; Vector2 p1 = s - w; Vector2 p2 = s + w; gui.Window((int)curwindow, Rect.MinMaxRect(p1.x, p1.y, p2.x, p2.y), f, windowTitle); windowTitle = curwindow + ""; } }
void Draw(Vector2 w, GUI.WindowFunction f, Wind wnd) { if (curwindow == wnd) { w /= 2; Vector2 s = new Vector2(Screen.width, Screen.height) / 2; Vector2 p1 = s - w; Vector2 p2 = s + w; gui.Window((int)curwindow, Rect.MinMaxRect(p1.x, p1.y, p2.x, p2.y), f, windowTitle); windowTitle = curwindow + ""; } }
/// <summary> /// 破棄 /// </summary> protected override void OnDestroy() { Compute.Dispose(); Wind.Dispose(); Team.Dispose(); Mesh.Dispose(); Bone.Dispose(); Particle.Dispose(); Component.Dispose(); base.OnDestroy(); }
void Start() { if (!Instance) { Instance = this; } else { enabled = false; } onWindChanged += OWC; }
public void Init() { // Czyli tutaj mamy referencję do wiatru w postaci lokalnej zmiennej wind var wind = new Wind(); StartSnow(wind); // A tu poniżej modyfikujemy na obiekcie wind wartość property Strength - jak popatrzysz na implementację to tak na prawdę w klasie Wind jest pole _strength czyli tak właściwie jest to rozwiązanie poprzez prywatne pole, a nie parametr - tylko, że prywatne pole jest nie tyle w klasie głównej co w klasie Wind, // ale na jedno wychodzi. wind.Stregth = 10; wind.Stregth = 20; wind.Stregth = -5; }
public void GetRoundedWind_NonRoundedFloat_RoundedValue(float temperature, string valid) { var wind = new Wind() { Speed = temperature }; var cityWeather = new CityWeather() { Wind = wind }; Assert.Equal(cityWeather.GetRoundedWind(), valid); }
public void GetWindDirection_DegreesFloat_ValidDirectionArrow(float degrees, string valid) { var wind = new Wind() { Degrees = degrees }; var cityWeather = new CityWeather() { Wind = wind }; Assert.Equal(valid, cityWeather.GetWindDirection()); }
void Start() { rigidbody = GetComponent<Rigidbody>(); wind = GameObject.FindWithTag("Wind").GetComponent<Wind>(); endGameLocation = GameObject.FindWithTag("End Game Destination").transform; // 2 player code if (GManager.singlePlayer && spotlightTarget) { horizontalInputName = "Single Player Lighthouse Vertical"; verticalInputName = "Single Player Lighthouse Horizontal"; } }
public WeatherForecastViewModel(WeatherForecast forecast, DateTime nextForcastDate) { Rain = new Precipitation(Math.Round(forecast.Precipitation.Value, _decimalAccuracy), forecast.Precipitation.PrecipitationType); Temperature = new Temperature( Math.Round(forecast.Temperature.Min, _decimalAccuracy), Math.Round(forecast.Temperature.Max, _decimalAccuracy), forecast.Temperature.Humidity); Wind = new Wind(Math.Round(forecast.Wind.Speed, _decimalAccuracy)); Description = forecast.Description; ForecastStartTime = forecast.ForecastTime.ToLocalTime().ToShortTimeString(); ForecastEndTime = nextForcastDate.ToLocalTime().ToShortTimeString(); }
// Start is called before the first frame update void Start() { direction = this.transform.parent.localEulerAngles.y != 0 ? 1 : -1; float freq = Random.Range(4.0f, 6.0f); foreach (Material m in this.GetComponent <Renderer>().materials) { m.SetFloat("_WindMultiplier", direction * Random.Range(0.7f, 0.15f)); m.SetFloat("_Frequency", freq); } wind = FindObjectOfType <Wind>(); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); moveForce = 10.0f; tr = GetComponent <Transform>(); if (SceneManager.GetActiveScene().name == "Level2" || SceneManager.GetActiveScene().name == "playArea") { Debug.Log("cant move back DUN NUNUNU"); canMoveBack = false; } wind = GameObject.Find("Globals/Wind").GetComponent <Wind>(); }
public void Awake() { playersManager.Init(); pointsHolder.SetActive(false); pointText.text = "0"; dealer = playersManager.PlayerList[0]; gameState = GameState.Waiting; currentWind = Wind.East; dealerNumber = 0; currentPoints = 0; }
public record Forecast( Coord coord, Weather[] weather, Main main, int visibility, Wind wind, Clouds clouds, long dt, Sys sys, int timezone, int id, string name, int cod);
/// <summary> /// Proceed sanity check of inserted values. /// </summary> /// <param name="errors">Found errors.</param> /// <param name="warnings">Found warnings.</param> public void SanityCheck(ref List <string> errors, ref List <string> warnings) { Date.SanityCheck(ref errors, ref warnings); Wind.SanityCheck(ref errors, ref warnings); Visibility.SanityCheck(ref errors, ref warnings); if (Phenomens != null) { if (Phenomens.IsEmpty()) { warnings.Add("Phenomens are used but are empty."); } Phenomens.SanityCheck(ref errors, ref warnings); } if (Clouds != null) { if (Clouds.IsEmpty()) { warnings.Add("Clouds are used but are empty."); } Clouds.SanityCheck(ref errors, ref warnings); } Pressure.SanityCheck(ref errors, ref warnings); if (RePhenomens != null) { if (RePhenomens.IsEmpty()) { warnings.Add("Re-phenomens are used but are empty."); } RePhenomens.SanityCheck(ref errors, ref warnings); } if (WindShears != null) { if (WindShears.IsEmpty()) { warnings.Add("Windshears are used but are empty."); } WindShears.SanityCheck(ref errors, ref warnings); } if (RunwayConditions != null) { if (RunwayConditions.IsEmpty()) { warnings.Add("Runway conditions are used but are empty."); } RunwayConditions.SanityCheck(ref errors, ref warnings); } if (Trend != null) { Trend.SanityCheck(ref errors, ref warnings); } }
public void TestShouldTurnAndMoveInTheRightDirection() { var map = new Map(5, 5); var tractor = new Tractor(map); var wind = new Wind(map, Orientation.North); var stone = new Stone(map, new Point(2, 3)); var testing = new Composit(map, new UnitCollection { tractor, wind, stone }); testing.ExecuteCommand(new TurnClockwiseCommand()); testing.ExecuteCommand(new MoveForwardCommand()); Assert.AreEqual(1, tractor.Position.X); Assert.AreEqual(0, tractor.Position.Y); testing.ExecuteCommand(new TurnClockwiseCommand()); testing.ExecuteCommand(new MoveForwardCommand()); Assert.AreEqual(1, tractor.Position.X); Assert.AreEqual(-1, tractor.Position.Y); testing.ExecuteCommand(new TurnClockwiseCommand()); testing.ExecuteCommand(new MoveForwardCommand()); Assert.AreEqual(0, tractor.Position.X); Assert.AreEqual(-1, tractor.Position.Y); testing.ExecuteCommand(new TurnClockwiseCommand()); testing.ExecuteCommand(new MoveForwardCommand()); Assert.AreEqual(0, tractor.Position.X); Assert.AreEqual(0, tractor.Position.Y); testing.ExecuteCommand(new TurnClockwiseCommand()); Assert.AreEqual(Orientation.East, wind.Orientation); testing.ExecuteCommand(new TurnClockwiseCommand()); Assert.AreEqual(Orientation.South, wind.Orientation); testing.ExecuteCommand(new TurnClockwiseCommand()); Assert.AreEqual(Orientation.West, wind.Orientation); testing.ExecuteCommand(new TurnClockwiseCommand()); Assert.AreEqual(Orientation.North, wind.Orientation); testing.ExecuteCommand(new MoveForwardCommand()); Assert.AreEqual(2, stone.Position.X); Assert.AreEqual(3, stone.Position.Y); testing.ExecuteCommand(new TurnClockwiseCommand()); Assert.AreEqual(2, stone.Position.X); Assert.AreEqual(3, stone.Position.Y); }
public GraphicDebug(Game game) { this.game = game; this.ball = game.GetBall(); this.wind = game.GetWind(); enabled = false; velocityLine = CreateLine("VelocityDebug", 0.125f, Color.red); windLine = CreateLine("WindDebug", 0.25f, Color.blue); cupEffectLine = CreateLine("CupEffectDebug", 0.25f, Color.green); fnetLine = CreateLine("FnetDebug", 0.25f, Color.white); groundLine = CreateLine("GroundLine", 1f, Color.black); }
public DailyForecast(Skycon skycon, Range temperature, Range humidity, Range precipitation, RangeWind wind, Astro astro) { CultureInfo provider = CultureInfo.InvariantCulture; Date = DateTime.ParseExact(temperature.date, "yyyy-MM-dd", provider); SunRise = TimeSpan.Parse(astro.sunrise.time); SunSet = TimeSpan.Parse(astro.sunset.time); Condition = new DailyCondition(skycon); HighTemp = Temperature.FromCelsius((float)temperature.max); LowTemp = Temperature.FromCelsius((float)temperature.min); Humidity = (uint)(humidity.avg * 100); Precipitation = (uint)precipitation.avg; Wind = new Wind(wind.avg); }
private void Init() { WthUserShift = new WeatherShifts[WeatherConstants.MAXUSERSHIFT]; WthWind = new Wind[5]; WthTemp = new Temp[5]; WthPress = new Press[5]; WthTurbu = new WthTurbu[7]; FogStart = new float[4]; FogEnd = new float[4]; StratusLayer = new int[4]; StratusThick = new int[4]; CumulusLayer = new int[4]; ContrailLayer = new int[4]; }
//в зависимотсти от того существовал объект до этого или нет сохраняем разными способами private void btnSave_Click(object sender, EventArgs e) { if (FinalWind == null) { Wind instr = new Wind(); GetWind(instr); MainForm.AddObject(instr); } else { GetWind(FinalWind); } Close(); }
private void windToolStripMenuItem_Click(object sender, EventArgs e) { WindDialogBox windDialogBox = new WindDialogBox(); windDialogBox.ShowDialog(); if (windDialogBox.DialogResult == DialogResult.OK) { Wind wind = new Wind(modifiedBitmap, windDialogBox.direction, windDialogBox.strengt); wind.ApplyEffect(setImage); history.AddElement(wind); windDialogBox.Dispose(); } modifiedImage.Image = modifiedBitmap; }
public override int GetHashCode() { unchecked { var hashCode = (Title != null ? Title.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Temperature != null ? Temperature.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Wind != null ? Wind.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Humidity != null ? Humidity.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Visibility != null ? Visibility.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Sunrise != null ? Sunrise.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Sunset != null ? Sunset.GetHashCode() : 0); return(hashCode); } }
static void Main(string[] args) { //https://tidesandcurrents.noaa.gov/api/datagetter?product=water_level //&begin_date=20200428&end_date=20200429 //&datum=MLLW&interval=h //&station=8770520&time_zone=GMT&units=english&format=json&application=NOS.COOPS.TAC.WL //https://tidesandcurrents.noaa.gov/api/datagetter?product=hourly_height //&begin_date=20170428&end_date=20170430 //&datum=MLLW //&station=8770520&time_zone=GMT&units=english&format=json&application=NOS.COOPS.TAC.WL /*Can add interval=60*/ //https://tidesandcurrents.noaa.gov/api/datagetter?product=predictions //&begin_date=20170428&end_date=20170430 //&datum=MLLW&interval=h //&station=8770520&time_zone=GMT&units=english&format=json&application=NOS.COOPS.TAC.WL //https://tidesandcurrents.noaa.gov/api/datagetter?product=water_temperature //&begin_date=20170428&end_date=20170430 //&datum=MLLW&interval=h //&station=8774230&time_zone=GMT&units=english&format=json&application=NOS.COOPS.TAC.WL /*Nothing found thus far*/ //https://tidesandcurrents.noaa.gov/api/datagetter?product=salinity //&begin_date=20170428&end_date=20170430 //&datum=MLLW&interval=h //&station=8774230&time_zone=GMT&units=english&format=json&application=NOS.COOPS.TAC.WL //https://tidesandcurrents.noaa.gov/api/datagetter?product=air_pressure //&begin_date=20170428&end_date=20170430 //&datum=MLLW&interval=h //&station=8774230&time_zone=GMT&units=english&format=json&application=NOS.COOPS.TAC.WL //https://tidesandcurrents.noaa.gov/api/datagetter?product=high_low //&begin_date=20170428&end_date=20170430 //&datum=MLLW&interval=h //&station=8774230&time_zone=GMT&units=english&format=json&application=NOS.COOPS.TAC.WL //This was the POC //WaterTemperature waterTemperature = new WaterTemperature(); //waterTemperature.SeedWaterTemp(); Wind wind = new Wind(); wind.SeedWind(); }
internal override Event ReadEntry(BinaryReaderEx br) { EventType type = br.GetEnum32 <EventType>(br.Position + 8); switch (type) { case EventType.Light: return(Lights.EchoAdd(new Event.Light(br))); case EventType.Sound: return(Sounds.EchoAdd(new Event.Sound(br))); case EventType.SFX: return(SFX.EchoAdd(new Event.SFX(br))); case EventType.Wind: return(Wind.EchoAdd(new Event.Wind(br))); case EventType.Treasure: return(Treasures.EchoAdd(new Event.Treasure(br))); case EventType.Generator: return(Generators.EchoAdd(new Event.Generator(br))); case EventType.Message: return(Messages.EchoAdd(new Event.Message(br))); case EventType.ObjAct: return(ObjActs.EchoAdd(new Event.ObjAct(br))); case EventType.SpawnPoint: return(SpawnPoints.EchoAdd(new Event.SpawnPoint(br))); case EventType.MapOffset: return(MapOffsets.EchoAdd(new Event.MapOffset(br))); case EventType.Navmesh: return(Navmeshes.EchoAdd(new Event.Navmesh(br))); case EventType.Environment: return(Environments.EchoAdd(new Event.Environment(br))); case EventType.PseudoMultiplayer: return(PseudoMultiplayers.EchoAdd(new Event.PseudoMultiplayer(br))); default: throw new NotImplementedException($"Unsupported event type: {type}"); } }
/// <summary> /// Метод для получения статистики /// </summary> private IList <WindChange> GetWindChanges() { int windsCount = Winds.Count() - 1; IList <WindChange> windChanges = new List <WindChange>(windsCount); for (int i = 0; i < windsCount; i++) { Wind currentWind = Winds.ElementAt(i); Wind nextWind = Winds.ElementAt(i + 1); WindChange windChange = new WindChange(currentWind, nextWind); windChanges.Add(windChange); } return(windChanges); }
private bool TryCreateNewWind(HexDirection nextDirection) { TileProperties nextTile = tile.GetNeighbor(nextDirection); if (CanCreateWindOnTile(nextTile)) { Wind newWind = WindManager.Instance.WindsPool.Pop(); newWind.transform.position = nextTile.transform.position; next.Add(newWind); newWind.InitializeChildWind(nextTile, this, nextDirection); return(true); } return(false); }
public HourlyForecast(JsonContract.HourlyForecastContract hourly_forecast) { if (hourly_forecast == null) { return; } CultureInfo provider = CultureInfo.InvariantCulture; DateTime = DateTime.ParseExact(hourly_forecast.date, "yyyy-MM-dd HH:mm", provider); Humidity = uint.Parse(hourly_forecast.hum); Pop = uint.Parse(hourly_forecast.pop); Pressure = Pressure.FromHPa(float.Parse(hourly_forecast.pres, provider)); Temprature = Temperature.FromCelsius(int.Parse(hourly_forecast.tmp)); Wind = new Wind(hourly_forecast.wind); }
/// <summary> /// Returns true if DisasterInfo instances are equal /// </summary> /// <param name="other">Instance of DisasterInfo to be compared</param> /// <returns>Boolean</returns> public bool Equals(DisasterInfo other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Date == other.Date || Date != null && Date.Equals(other.Date) ) && ( Water == other.Water || Water != null && Water.Equals(other.Water) ) && ( Lt == other.Lt || Lt != null && Lt.Equals(other.Lt) ) && ( Wind == other.Wind || Wind != null && Wind.Equals(other.Wind) ) && ( Freeze == other.Freeze || Freeze != null && Freeze.Equals(other.Freeze) ) && ( Ht == other.Ht || Ht != null && Ht.Equals(other.Ht) ) && ( Burn == other.Burn || Burn != null && Burn.Equals(other.Burn) )); }
public ForecastEntity ConvertEntity(Forecast forecast) { Clouds clouds = forecast.Clouds; PredictionDate predictionDate = forecast.Time; WeatherMain weatherMain = forecast.WeatherMain; Wind wind = forecast.Wind; ForecastEntity forecastEntity = new ForecastEntity { Clouds = clouds, PredictionDate = predictionDate, WeatherMain = weatherMain, Wind = wind }; return(forecastEntity); }
public void TestShouldTurn() { var testing = new Wind(new Map(5, 5), Orientation.North); testing.ExecuteCommand(new TurnClockwiseCommand()); Assert.AreEqual(Orientation.East, testing.Orientation); testing.ExecuteCommand(new TurnClockwiseCommand()); Assert.AreEqual(Orientation.South, testing.Orientation); testing.ExecuteCommand(new TurnClockwiseCommand()); Assert.AreEqual(Orientation.West, testing.Orientation); testing.ExecuteCommand(new TurnClockwiseCommand()); Assert.AreEqual(Orientation.North, testing.Orientation); }
/// <summary> /// 暗杠或大明杠 /// </summary> /// <param name="tiles"></param> /// <param name="type"></param> /// <param name="extra"></param> /// <param name="self"></param> public Gan(Tile[] tiles, GroupType type = GroupType.门清, Tile extra = null, Wind self = Wind.None) { if (type == GroupType.和牌) { throw new ArgumentException("杠子无法导致和牌", nameof(type)); } this.Key = tiles[0].BaseTile; this.Tiles = tiles; this.Type = type; if (type == GroupType.副露) { SetFieldsFor副露(extra, self, true); // 大明杠 } }
public ForecastDaily() { Temperature = new Temperature(); Humidity = new Humidity(); Wind = new Wind(); }
public Weather(Location location, Atmosphere atmosphere, Wind wind, Condition condition) { Location = location; Atmosphere = atmosphere; Wind = wind; Condition = condition; }
void Start() { Application.targetFrameRate = 60; Time.captureFramerate = 60; maxSpeed = defaultMaxSpeed; speed_x = 0.0f; speed_y = 0.0f; button.transform.position = new Vector3 ((float)Screen.width + 75.0f, (float)Screen.height + 75.0f,0.0f ); wind = GetComponent<Wind> (); fire = GetComponent<Fire> (); ice = GetComponent<Ice> (); earth = GetComponent<Earth> (); }
public Forecast( DateTime date, int minTemperature, int maxTemperature, WeatherCode weatherCode, int minRelativeHumidity, int maxRelativeHumidity, Wind wind) : this(date, minTemperature, maxTemperature, weatherCode) { if ((minRelativeHumidity < MIN_VALID_HUMIDITY) || (minRelativeHumidity > MAX_VALID_HUMIDITY)) { throw new ArgumentOutOfRangeException("minRelativeHumidity"); } if ((maxRelativeHumidity < MIN_VALID_HUMIDITY) || (maxRelativeHumidity > MAX_VALID_HUMIDITY)) { throw new ArgumentOutOfRangeException("maxRelativeHumidity"); } this.minRelativeHumidity = minRelativeHumidity; this.maxRelativeHumidity = maxRelativeHumidity; this.wind = wind; }
// Use this for initialization void Start() { wind = GameObject.Find("GameController").GetComponent<Wind>(); cloth = gameObject.GetComponent<Cloth>(); }
public override void Initialize() { base.Initialize(); levelTime = 0; if (!hasPlayed) { for (int i = 0; i < heightMap.Length; i++) { heightMap[i] = (float)(64 + 16 * Math.Sin(i / 4096.0f * Math.PI * 32)); canSculpt[i] = TerrainType.SAND; } } levelMode = LevelMode.EDIT; scrollX = 0; scrollSpeed = 300; brushSize = 224; landscapeBrush = new Rectangle(0, 0, (int)(brushSize * 1.5f), (int)brushSize); play = new MenuButton(buttonTex, new Point(96, 96), new Point(0, 0), new Point(96, 96), new Point(8, 8), "PLAY"); play.font = MenuJewSaver.font; play.buttonPressed += OnPlayPressed; restart = new MenuButton(buttonTex, new Point(96, 96), new Point(0, 0), new Point(96, 96), new Point(8, 8), "RESET"); restart.font = MenuJewSaver.font; restart.buttonPressed += OnRestartPressed; exit = new MenuButton(buttonTex, new Point(96, 96), new Point(0, 0), new Point(96, 96), new Point(JewSaver.width - 8 - 96, 8), "QUIT"); exit.font = MenuJewSaver.font; exit.buttonPressed += OnQuitPressed; stickies = new Stickfigure[numberOfStickies]; collisionBuckets = new List<Stickfigure>[128]; for (int i = 0; i < 128; i++) collisionBuckets[i] = new List<Stickfigure>(); for (int i = 0; i < numberOfStickies; i++) stickies[i] = new Stickfigure(new Vector2(-50.0f, 0), i + 1); moses = new Stickfigure(new Vector2(50, 200), 0); moses.SetIsPlayer(); jumpMarkers.Clear(); sprintMarkers.Clear(); finalTexts.Clear(); showText = false; openingText = false; gameAllOver = false; gameLost = false; frames = 0; fpsTime = 0.0; locusts = new List<Locust>(); locustTimeout = new TimeSpan(0, 0, 15); locustTime = new TimeSpan(0, 1, 0); plagueLength = 0; hasLocusts = false; if (!hasPlayed) { stars = new Sprite[JewSaver.height]; for (int i = 0; i < stars.Length; i++) { stars[i] = new Sprite(star, 8, 8, 0, 0, 8, 8, random.Next(2048), random.Next(64)); stars[i].Alpha = (64 - stars[i].screenRectangle.Top) / 96.0f; } textTimer = 0; showText = false; } goToNextLevel = false; treasure = new List<Schekel>(); enableWind = false; wind = new Wind(new TimeSpan(0, 0, 30)); if (hasPlayed) { for (int i = 0; i < heightMap.Length; i++) heightMap[i] = heightMapBak[i]; } }
public async static Task<Wind> ImportAsync(GeoRect region, string smgcDirectory, IProgress<float> progress = null) { const int maxDegreeOfParallelism = -1; if (progress != null) lock (progress) progress.Report(0f); var north = (float)Math.Ceiling(region.North); var south = (float)Math.Floor(region.South); var east = (float)Math.Ceiling(region.East); var west = (float)Math.Floor(region.West); var progressStep = 100f / (((north - south) * (east - west)) + 13); var totalProgress = 0f; var parallelReader = new TransformBlock<string, SMGCFile>(data => { var file = new SMGCFile(data); if (progress != null) lock (progress) progress.Report(totalProgress += progressStep); return file; }, new ExecutionDataflowBlockOptions { TaskScheduler = TaskScheduler.Default, BoundedCapacity = -1, MaxDegreeOfParallelism = maxDegreeOfParallelism, }); if (progress != null) lock (progress) progress.Report(totalProgress += progressStep); // Construct a list of files we will need to read out of the SMGC database var selectedLocations = new List<Geo>(); var allFiles = Directory.GetFiles(smgcDirectory, "*.stt", SearchOption.AllDirectories).ToList(); #if SMGC_IMPORTER_BUILD // This chunk of code is ONLY for the SMGC importer and should only be compiled when running that utility foreach (var file in allFiles) parallelReader.Post(file); var batchBlock = new BatchBlock<SMGCFile>(allFiles.Count); #else for (var lat = south; lat <= north; lat++) { //Console.WriteLine("{0}: Processing latitude {1}", DateTime.Now, lat); for (var lon = west; lon <= east; lon++) { var northSouth = (lat >= 0) ? "n" : "s"; var eastWest = (lon >= 0) ? "e" : "w"; var curFileName = string.Format("{0}{1:00}{2}{3:000}.stt", northSouth, Math.Abs(lat), eastWest, Math.Abs(lon)); var matchingFiles = (from curFile in allFiles where curFile.EndsWith(curFileName) select curFile).ToList(); if (!matchingFiles.Any()) continue; parallelReader.Post(matchingFiles.First()); selectedLocations.Add(new Geo(lat, lon)); } } var batchBlock = new BatchBlock<SMGCFile>(selectedLocations.Count); #endif parallelReader.LinkTo(batchBlock); parallelReader.Complete(); await parallelReader.Completion; IList<SMGCFile> selectedFiles = batchBlock.Receive().ToList(); var parallelSelector = new TransformBlock<TimePeriod, TimePeriodEnvironmentData<WindSample>>(timePeriod => { var curTimePeriodData = new TimePeriodEnvironmentData<WindSample> { TimePeriod = timePeriod }; curTimePeriodData.EnvironmentData.AddRange(from selectedFile in selectedFiles where (selectedFile.Months != null) && (selectedFile[timePeriod] != null) select new WindSample(selectedFile.Geo, selectedFile[timePeriod].MeanWindSpeed)); return curTimePeriodData; }, new ExecutionDataflowBlockOptions { TaskScheduler = TaskScheduler.Default, BoundedCapacity = -1, MaxDegreeOfParallelism = maxDegreeOfParallelism, }); var wind = new Wind(); foreach (var curMonth in NAVOConfiguration.AllMonths) parallelSelector.Post(curMonth); var selectorBlock = new BatchBlock<TimePeriodEnvironmentData<WindSample>>(NAVOConfiguration.AllMonths.Count()); parallelSelector.LinkTo(selectorBlock); parallelSelector.Complete(); await parallelSelector.Completion; wind.TimePeriods.AddRange(selectorBlock.Receive()); return wind; }
public CaptainPlanet(Earth earth, Wind wind, Fire fire, Water water, Heart heart) { }
public void Show(Wind window) { enabled = true; this.curwindow = window; }
void OnEnable () { player = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>(); wind = gameObject.GetComponent<Wind>(); StartCoroutine(AddMist()); }
// Use this for initialization void Start() { _player = GameObject.Find ("/Player"); com = _player.GetComponent<Wind> (); }
/// <summary> /// Called on initialization of this component. /// </summary> public void Awake() { if (FindObjectsOfType<Wind>().Length > 1) { Debug.LogError("There can never be 2 Wind components in the same scene."); Destroy(this); } _instance = FindObjectOfType<Wind>(); }