private void TemperatureChange() { if (temperature < 600 && currentHeat != Heat.cold) { StartCoroutine("ColorChange", Color.black); currentHeat = Heat.cold; } else if (temperature >= 600 && temperature < 800 && currentHeat != Heat.red) { StartCoroutine("ColorChange", red); currentHeat = Heat.red; } else if (temperature >= 800 && temperature < 1000 && currentHeat != Heat.orange) { StartCoroutine("ColorChange", orange); currentHeat = Heat.orange; } else if (temperature >= 1000 && temperature < 1200 && currentHeat != Heat.yellow) { StartCoroutine("ColorChange", yellow); currentHeat = Heat.yellow; } else if (temperature > 1200 && currentHeat != Heat.white) { StartCoroutine("ColorChange", white); currentHeat = Heat.white; } }
public static bool GoIntoHeat(this Creature creature, byte intensity, out string output) { if (creature.perks.HasTimedEffect <Heat>()) { var heat = creature.perks.GetTimedEffectData <Heat>(); bool retVal = heat.IncreaseHeat(intensity); output = null; if (retVal) { output = heat.IncreasedHeatText(); } return(retVal); } else if (creature.hasVagina && !creature.womb.isPregnant) { ushort timeout = (intensity * Heat.TIMEOUT_STACK > ushort.MaxValue) ? ushort.MaxValue : (ushort)(intensity * Heat.TIMEOUT_STACK); var heat = new Heat(timeout); creature.perks.AddTimedEffect(heat); output = heat.ObtainText(); return(true); } else { output = null; return(false); } }
void Update() { if (currentPlant == null) { return; } var entity = currentPlant.GetComponent <GameObjectEntity>().Entity; if (!manager.Exists(entity)) { currentPlant = null; debugLines.enabled = false; return; } ; currentFuel = manager.GetComponentData <Fuel>(entity); currentHeat = manager.GetComponentData <Heat>(entity); heat.text = currentHeat.heat.ToString(); fuel.text = currentFuel.fuel.ToString(); neighbors.text = currentNeighbors.Length.ToString(); debugLines.enabled = drawRays.isOn; }
public IList <Pipe> GetPipesToExport() { try { // PipeTestResult result = null; // Inspector inspector = null; // Certificate certificate = null; // var q = session.QueryOver<Pipe>() // .Where(n => ((n.ToExport == true))) // .JoinAlias(r => r.PipeTestResult, () => result, JoinType.LeftOuterJoin) // .JoinAlias(() => result.Inspectors, () => inspector, JoinType.LeftOuterJoin) // .JoinAlias(() => inspector.Certificates, () => certificate, JoinType.LeftOuterJoin) // .TransformUsing(Transformers.DistinctRootEntity) // .List<Pipe>(); //return q; Plate plate = null; Heat heat = null; PlateManufacturer plateMan = null; PipeMillSizeType type = null; PipeTest tests = null; PipeTestResult result = null; Inspector inspector = null; Certificate certificate = null; Project proj = null; SeamType seam = null; Spool spool = null; File attach = null; var q = session.QueryOver <Pipe>() .Where(n => ((n.ToExport == true))) .JoinAlias(r => r.PipeTestResult, () => result, JoinType.LeftOuterJoin) .JoinAlias(() => result.Inspectors, () => inspector, JoinType.LeftOuterJoin) .JoinAlias(() => inspector.Certificates, () => certificate, JoinType.LeftOuterJoin) .JoinAlias(p => p.Plate, () => plate, JoinType.LeftOuterJoin) .JoinAlias(() => plate.Heat, () => heat, JoinType.LeftOuterJoin) .JoinAlias(() => heat.PlateManufacturer, () => plateMan, JoinType.LeftOuterJoin) .JoinAlias(t => t.Type, () => type, JoinType.LeftOuterJoin) .JoinAlias(() => type.SeamType, () => seam, JoinType.LeftOuterJoin) .JoinAlias(() => type.PipeTests, () => tests, JoinType.LeftOuterJoin) .JoinAlias(t => t.Spools, () => spool, JoinType.LeftOuterJoin) .JoinAlias(t => t.Attachments, () => attach, JoinType.LeftOuterJoin) .JoinAlias(t => t.Project, () => proj, JoinType.LeftOuterJoin) .Fetch(o => o.PurchaseOrder).Eager .Fetch(r => r.Railcar).Eager .TransformUsing(Transformers.DistinctRootEntity) .List <Pipe>(); return(q); } catch (GenericADOException ex) { throw new RepositoryException("GetPipesToExport", ex); } }
public LinkedList <Round> ArangeHeats() { LinkedList <Round> rounds = new LinkedList <Round>(); //The first round is randmoly assigned Round round1 = randomAssignRound(1, _drivers); rounds.AddLast(round1); EvaluateWhichDriversMet(round1); //Sort the drivers list descending by the diffrence to the expected avg starting position IOrderedEnumerable <Driver> drivers = _drivers.OrderByDescending(o => o.diffAvgPositionToExpected(_expectedAvgStartingPosition)); //For the other rounds assigne based on the statistics of diff to avg starting position ans drivers met for (int i = 2; i <= _numRounds; i++) { Round round = new Round(i, _numHeats, _heatSize); foreach (Driver driver in drivers) { Heat heat = findHeatForDriver(round, driver); int recommendedStartingPosition = nextStartingPosition(driver); int startingPosition = findFreeStartingPosition(heat, recommendedStartingPosition); heat.addDriverToGrid(startingPosition, driver); } rounds.AddLast(round); EvaluateWhichDriversMet(round); //Sort the drivers list descending by the diffrence to the expected avg starting position drivers = drivers.OrderByDescending(o => o.diffAvgPositionToExpected(_expectedAvgStartingPosition)); } return(rounds); }
// *** ADD *** // public async Task <Heat> AddAsync(int eventId) { var heats = GetHeatsForEvent(eventId); int nextHeatNumber; if (heats.Count() == 0) { //For first heat nextHeatNumber = 0; } else { nextHeatNumber = heats.Last().HeatNumber + 1; } var heat = new Heat { HeatNumber = nextHeatNumber, EventId = eventId, Deleted = false, }; await _repo.InsertAsync(heat); return(heat); }
public IActionResult AddResult(NewHeatResult heat) { if (!ModelState.IsValid) { return(RedirectToAction("Index")); } var newHeat = new Heat { Date = DateTime.Now, }; _mkContext.Heats.Add(newHeat); _mkContext.SaveChanges(); var scores = heat.Scores .Where(x => x.Player.HasValue) .Select(x => new HeatScore { PlayerId = _mkContext.Players.Single(p => p.Id == x.Player).Id, Score = x.Points.Value, HeatId = newHeat.Id }) .ToList(); _mkContext.HeatScores.AddRange(scores); _mkContext.SaveChanges(); return(RedirectToAction("Index")); }
public override int GetHashCode() { var hashCode = 505786036; hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Key); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Hash); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(SongName); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(SongSubName); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(LevelAuthorName); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(SongAuthorName); hashCode = hashCode * -1521134295 + EqualityComparer <List <DifficultyStats> > .Default.GetHashCode(Diffs); hashCode = hashCode * -1521134295 + Bpm.GetHashCode(); hashCode = hashCode * -1521134295 + PlayedCount.GetHashCode(); hashCode = hashCode * -1521134295 + Upvotes.GetHashCode(); hashCode = hashCode * -1521134295 + Downvotes.GetHashCode(); hashCode = hashCode * -1521134295 + Heat.GetHashCode(); hashCode = hashCode * -1521134295 + Rating.GetHashCode(); return(hashCode); }
public void Release() { IsPressEnding = IsPressed; IsPressStaring = false; IsPressed = false; Heat = Heat.DecrementUntil(0); }
public void AddHeat_ShouldBeOne(Race race, Heat heat) { race.Heats.ToList().Clear(); race.AddHeat(heat); race.Heats.ToList().Count.ShouldBe(1); }
//bloki romywania i wyostrzania metodą min max a nastepnie środekCiezkosci private void BlokWnioskowaniaOgrzewania(ref Heat Out, ChartItem5Value in1, ChartItem1Value in2) { double min, low, mid, mor, max, join; for (int i = 0; i < Out.Count; i++) { if (in1.Min + in1.Low + in1.Mid < 1 && in1.Mor + in1.Max > 0) { min = Min(in2.Y, 1, Out[i].Min); } else { min = Min(in2.Y, in1.Mid, Out[i].Min); } mid = Min(in2.Y, in1.Low, Out[i].Mid); if (in1.Min + in1.Low + in1.Mid < 1 && in1.Mor + in1.Max == 0) { max = Min(in2.Y, 1, Out[i].Max); } else { max = Min(in2.Y, in1.Min, Out[i].Max); } mor = 0; low = 0; join = Max(min, low, mid, mor, max); Out[i].ZbiorWnioskowania = join; Out[i].Text = Out.AddTextJoin(Out[i].Text, join); } BlokWyostrzania(ref Out); }
public void ActivateHeat(Heat heat, IEnumerable <TRace> races) { var heatState = new HeatState <TRace, TRacePassing, TRaceLap>(Distance, heat, races, calculatorManager.Get(Distance.Discipline)); heatState.Activate(); activeHeats[heat] = heatState; }
public IHttpActionResult PutHeat(int id, Heat heat) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != heat.Id) { return(BadRequest()); } db.Entry(heat).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HeatExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
// Use this for initialization void Start() { body = GetComponent <Rigidbody2D> (); Dialog = UnityEngine.Object.FindObjectOfType <DialogManager> (); audioManager = UnityEngine.Object.FindObjectOfType <AudioManager>(); audioManager.PlaySound(1); Body = new Body(); Scanner = new Scanner(); Booster = new Booster(); Probe = new Probe(); Subzero = new Subzero(); Heat = new Heat(); Body.Start(); Scanner.Start(); Booster.Start(); Probe.Start(); Subzero.Start(); Heat.Start(); //hard coding some values in to make sure the rings work curr_battery = 100; true_battery = 100; starsVisited = 0; menuOpen = false; setUpTimer(); if (Global_Static.Continue) { Load(); } }
private Heat ImportHeat(HeatObject heatObj) { if (heatObj == null) { return(null); } bool isNew = false; Heat heat = importRepo.HeatRepo.Get(heatObj.Id); if (heat == null) { heat = new Heat(); isNew = true; } heat.Id = heatObj.Id; heat.IsActive = heatObj.IsActive; heat.Number = heatObj.Number; heat.SteelGrade = heatObj.SteelGrade; heat.PlateManufacturer = ImportPlateManifacturer(heatObj.PlateManufacturer); if (isNew) { importRepo.HeatRepo.Save(heat); } else { importRepo.HeatRepo.SaveOrUpdate(heat); } return(heat); }
public HeatObject(Heat heat) { this.Id = heat.Id; this.IsActive = heat.IsActive; this.Number = heat.Number; this.SteelGrade = heat.SteelGrade; this.PlateManufacturer = heat.PlateManufacturer; }
public HeatLapPointsChangedEvent(Distance distance, Heat heat, int index, decimal rounds, decimal roundsToGo, int passedLength, IReadOnlyList <RaceLapState> laps) : base(distance, heat) { Index = index; Rounds = rounds; RoundsToGo = roundsToGo; PassedLength = passedLength; Laps = laps; }
public void given_a_pizzaBuilder_build_pizza_then_we_got_a_pizza_with_low_heat() { Heat expectedHeat = Heat.Low; Pizza pizza = new PizzaBuilder() .Build(); Assert.IsNotNull(pizza); Assert.AreEqual(expectedHeat, pizza.GetHeat()); }
public void SetLineup_AddTwoDogsAndRegular_ThenFourSpots(Dog dog1, Dog dog2, Division division) { var heat = new Heat(); division.RacingClass = RacingClass.Regular; heat.AddDogToLineup(division, dog1, dog2); heat.Lineup.ToList().Count.ShouldBe(4); }
public void SetLineup_AddTwoDogsAndOpen_ThenThreeSpots(Dog dog1, Dog dog2, Division division) { var heat = new Heat(); division.RacingClass = RacingClass.Open; heat.AddDogToLineup(division, dog1, dog2); heat.Lineup.ToList().Count.ShouldBe(3); }
public void SetLineup_AddOneDogsAndRegular_ThenThreeSpots(Dog dog1, Division division) { var heat = new Heat(); division.RacingClass = RacingClass.Regular; heat.AddDogToLineup(division, dog1); heat.Lineup.ToList().Count.ShouldBe(3); }
public void SetLineup_AddFourDogsAndOpen_ThenFiveSpots(Dog dog1, Dog dog2, Dog dog3, Dog dog4, Division division) { var heat = new Heat(); division.RacingClass = RacingClass.Open; heat.AddDogToLineup(division, dog1, dog2, dog3, dog4); heat.Lineup.ToList().Count.ShouldBe(5); }
public IHttpActionResult GetHeat(int id) { Heat heat = db.Heats.Find(id); if (heat == null) { return(NotFound()); } return(Ok(heat)); }
public void AddTime_WhenSecondDog_ThenReturnsSecondPosition(Division division, Heat heat, Dog dog1, Dog dog2, Dog dog3, Dog dog4, Fault fault, double time) { division.RacingClass = RacingClass.Regular; heat.AddDogToLineup(division, dog1, dog2, dog3, dog4); fault = null; var vut = heat.AddTime(dog2, Position.Second, time, fault, division); vut.Position.ShouldBe(Position.Third); }
public void AddTime_AddThirdDog_ThenReturnsFourthDogInLineup(Division division, Heat heat, Dog dog1, Dog dog2, Dog dog3, Dog dog4, Fault fault, double time) { division.RacingClass = RacingClass.Regular; heat.AddDogToLineup(division, dog1, dog2, dog3, dog4); fault = null; var vut = heat.AddTime(dog3, Position.Third, time, fault, division); vut.Dog.ShouldBe(dog4); }
public ActionResult Heating(int room_temp, bool windowCheckbox, bool acCheckbox) { var heat = new Heat(); heat.AC_status = acCheckbox; heat.Window_status = windowCheckbox; heat.Room_temp_Page4 = room_temp; db.Heats.Add(heat); db.SaveChanges(); return(View()); }
public HeatMap(Vector2Int mapSize, int weight = 1) { heatTiles = new Heat[mapSize.x, mapSize.y]; for (int x = 0; x < heatTiles.GetLength(0); x++) { for (int y = 0; y < heatTiles.GetLength(1); y++) { heatTiles[x, y] = new Heat(0, 1); } } }
private void BlokWyostrzania(ref Heat Out) { double up = 0; double above = 0; for (int i = 1; i < Out.Count; i++) { up += Out[i].X * Out[i].ZbiorWnioskowania; above += Out[i].ZbiorWnioskowania; } CenterOfGravityHeater = (above == 0)?0: Math.Round(up / above); }
public void DeactivateHeat(Heat heat) { if (!activeHeats.ContainsKey(heat)) { return; } var heatState = activeHeats[heat]; heatState.Deactivate(); activeHeats.Remove(heat); }
public IHttpActionResult PostHeat(Heat heat) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Heats.Add(heat); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = heat.Id }, heat)); }
IEnumerator Start() { m_target = null; m_controller = GetComponent<CharacterController>(); m_heatComponent = GetComponent<Heat>(); m_synapseBrain = new SynapseLibrary_SynapseDemo.Demo.NPC(this); while(Application.isPlaying && m_synapseBrain != null) { AIUpdate(); yield return new WaitForSeconds(1); } }
private void toolStripButtonBuildRaces_Click(object sender, EventArgs e) { int racerCount = 1; // Set up the lane rotation for each lane int [] laneAssignment1 = new int[] { 1, 2, 3, 4}; int [] laneAssignment2 = new int[] { 2, 3, 4, 1}; int [] laneAssignment3 = new int[] { 3, 4, 1, 2}; int [] laneAssignment4 = new int[] { 4, 1, 2, 3}; int[] laneAssignment = null; foreach (Racer racer in RaceDataStore.RacerList) { // Clear any existing Heat records racer.Heats.Clear(); racer.Heats = new List<Heat>(4); Heat[] heatList = new Heat[] { new Heat(1), new Heat(2), new Heat(3), new Heat(4) }; racer.Heats.AddRange(heatList); // Select the appropriate Lane Assignment array switch (racerCount) { case 1: laneAssignment = laneAssignment1; break; case 2: laneAssignment = laneAssignment2; break; case 3: laneAssignment = laneAssignment3; break; case 4: laneAssignment = laneAssignment4; break; } // Loop thru heats and assign lanes for (int x = 0; x < 4; x++) { racer.Heats[x].Lane = laneAssignment[x]; } if (racerCount == 4) { racerCount = 1; } else { racerCount++; } } // Load Heat the first heat (Heat # should // be 1 at this point) RaceDataStore.RaceProc.LoadNextHeat(); // Store the number of Races in each heat - we have // an even number of racers so each stack represents the // number of races in the heat. RaceDataStore.RaceCount = RaceDataStore.LanePool.Lane1Stack.Count; // Reload our TreeView this.LoadTreeView(); if (RaceDataStore.RacerList.Count > 0) { this.toolStripStatusLabel1.Text = "Step 2: Lane assignments complete, we are go for racing"; } else { this.toolStripStatusLabel1.Text = "Warning: Lane assignments are not complete."; } }