public override void LoadData() { isBuildMode = Load <bool>(identifier_isBuildMode); playingChara = Load <int>(identifier_playingChara); greenHealth = Load <HealthInfo>(identifier_greenHealth); whiteHealth = Load <HealthInfo>(identifier_whiteHealth); }
/// <summary> /// Reads data from a SaveReader. Override this in a derived class to read object-specific data. /// </summary> /// <param name="reader">The SaveReader to read from. No guarantees can be made about its ending offset.</param> /// <param name="baseOffset">The offset of the start of the object data.</param> protected virtual void ReadFrom(SaveReader reader, long baseOffset) { _tag = DatumIndex.ReadFrom(reader); reader.SeekTo(baseOffset + StrengthInfoOffset); // Using the default Master Chief values is kind of hackish, // but at the same time it would be overkill to have a huge DB of original health/shield values. _healthInfo = new HealthInfo(reader, DefaultChiefHealthModifier, DefaultChiefShieldModifier); reader.SeekTo(baseOffset + PositionOffset1); _position.X = reader.ReadFloat(); _position.Y = reader.ReadFloat(); _position.Z = reader.ReadFloat(); reader.SeekTo(baseOffset + PositionOffset2); _unkPosition.X = reader.ReadFloat(); _unkPosition.Y = reader.ReadFloat(); _unkPosition.Z = reader.ReadFloat(); _unkPosition = Vector3.Subtract(_unkPosition, _position); reader.SeekTo(baseOffset + CarryInfoOffset); _nextCarriedIndex = DatumIndex.ReadFrom(reader); _firstCarriedIndex = DatumIndex.ReadFrom(reader); _carrierIndex = DatumIndex.ReadFrom(reader); }
public async Task <IActionResult> PutHealthInfo([FromRoute] short id, [FromBody] HealthInfo healthInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != healthInfo.HealthInfoId) { return(BadRequest()); } _context.Entry(healthInfo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HealthInfoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Statistics() { HP = new HealthInfo(); PvP = new PVPInfo(); Quests = new QuestInfo(); Work = new WorkInfo(); }
public void Initialize() { Health = new HealthInfo(); Health.MaxHealth = HealthSO.MaxHealth; Health.CurrentHealth = HealthSO.MaxHealth; Health.PassiveHealthRegenSpeed = HealthSO.PassiveHealthRegenSpeed; }
public CombatDebugOverlay(Actor self) { healthInfo = self.Info.TraitInfoOrDefault<HealthInfo>(); coords = Exts.Lazy(self.Trait<BodyOrientation>); var localPlayer = self.World.LocalPlayer; devMode = localPlayer != null ? localPlayer.PlayerActor.Trait<DeveloperMode>() : null; }
public UserStatusData() { isBuildMode = false; playingChara = 0; greenHealth = new HealthInfo(100, 100); whiteHealth = new HealthInfo(70, 70); LoadData(); }
public virtual bool ShouldBeDead(HealthInfo info) { bool res = info.CurHP <= 0f; if (res) { Die(); } return(res); }
public static HealthResponse ToHealthResponse(this HealthInfo info) { return(new HealthResponse { Health = MapHealth(info.Health), Description = info.Description, Name = info.Name, Checks = info.CheckResults.Select(ToCheckResultResponse).ToList() }); }
public CombatDebugOverlay(Actor self) { healthInfo = self.Info.TraitInfoOrDefault<HealthInfo>(); blockInfo = self.Info.TraitInfoOrDefault<BlocksProjectilesInfo>(); attack = Exts.Lazy(() => self.TraitOrDefault<AttackBase>()); coords = Exts.Lazy(() => self.Trait<BodyOrientation>()); var localPlayer = self.World.LocalPlayer; devMode = localPlayer != null ? localPlayer.PlayerActor.Trait<DeveloperMode>() : null; }
public Task <HealthInfo[]> GetAllAsync() { if (Datas == null) { Datas = HealthInfo.DeserialiseData(@"C:\Users\Frédéric\source\repos\Heart\Heart\Dataset\heart.csv").ToArray(); Summaries = Datas[0].Header().Split("\t"); } return(Task.FromResult(Datas)); }
public async Task <ActionResult <HealthInfo> > PostHealthInfo(int userId, HealthInfo healthInfo) { var user = await _context.Users.FindAsync(userId); _context.HealthInfos.Add(healthInfo); user.HealthInfo = healthInfo; await _context.SaveChangesAsync(); // return CreatedAtRoute("GetHealthInfo", new { id = healthInfo.Id }, healthInfo); return(NoContent()); }
public async Task <IActionResult> PostHealthInfo([FromBody] HealthInfo healthInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.HealthInfo.Add(healthInfo); await _context.SaveChangesAsync(); return(CreatedAtAction("GetHealthInfo", new { id = healthInfo.HealthInfoId }, healthInfo)); }
public override void DeleteData() { Delete(identifier_isBuildMode); Delete(identifier_playingChara); Delete(identifier_greenHealth); Delete(identifier_whiteHealth); isBuildMode = false; playingChara = 0; greenHealth = new HealthInfo(100, 100); whiteHealth = new HealthInfo(70, 70); }
Task <HealthInfo> IHealthCheck.Check() { var info = new HealthInfo { ItemName = nameof(RabbitMQPoster), Items = new List <HealthItem>() }; info.Items.Add(ProduceTest()); info.Items.Add(ConsumerTest()); return(Task.FromResult(info)); }
async Task <HealthInfo> IHealthCheck.Check() { var info = new HealthInfo { ItemName = nameof(RedisFlow), Items = new List <HealthItem>() }; info.Items.Add(await SetTest()); info.Items.Add(await GetTest()); info.Items.Add(await DelTest()); return(info); }
async Task <HealthInfo> IHealthCheck.Check() { var info = new HealthInfo { ItemName = nameof(KafkaPoster), Items = new List <HealthItem>() }; info.Items.Add(await ProduceTest()); info.Items.Add(ConsumerTest()); return(info); }
/// <summary> /// Reads data from a SaveReader. Override this in a derived class to read object-specific data. /// </summary> /// <param name="reader">The SaveReader to read from. No guarantees can be made about its ending offset.</param> /// <param name="baseOffset">The offset of the start of the object data.</param> protected virtual void ReadFrom(SaveReader reader, long baseOffset) { _tag = DatumIndex.ReadFrom(reader); reader.SeekTo(baseOffset + StrengthInfoOffset); _healthInfo = new HealthInfo(reader, DefaultChiefHealthModifier, DefaultChiefShieldModifier, float.PositiveInfinity); //reader.SeekTo(baseOffset + 0x18); // TODO: get offset for BSP zone //_zone = (ushort)((reader.ReadUInt32() & 0xFFFF0000) >> 16); // Read Position reader.SeekTo(baseOffset + PositionOffset1); _positionMain.X = reader.ReadFloat(); _positionMain.Y = reader.ReadFloat(); _positionMain.Z = reader.ReadFloat(); // Read Position2 Vector3 position2 = new Vector3(); reader.SeekTo(baseOffset + PositionOffset2); position2.X = reader.ReadFloat(); position2.Y = reader.ReadFloat(); position2.Z = reader.ReadFloat(); // Read Position3 Vector3 position3 = new Vector3(); reader.SeekTo(baseOffset + PositionOffset3); position3.X = reader.ReadFloat(); position3.Y = reader.ReadFloat(); position3.Z = reader.ReadFloat(); // Read Position4 Vector3 position4 = new Vector3(); reader.SeekTo(baseOffset + PositionOffset4); position4.X = reader.ReadFloat(); position4.Y = reader.ReadFloat(); position4.Z = reader.ReadFloat(); // Compute position deltas _position2Delta = Vector3.Subtract(position2, _positionMain); _position3Delta = Vector3.Subtract(position3, _positionMain); _position4Delta = Vector3.Subtract(position4, _positionMain); reader.SeekTo(baseOffset + CarryInfoOffset); _nextCarriedIndex = DatumIndex.ReadFrom(reader); _firstCarriedIndex = DatumIndex.ReadFrom(reader); _carrierIndex = DatumIndex.ReadFrom(reader); }
/// <summary> /// Start lidar (at least try) /// </summary> /// <param name="mode">Scan mode</param> /// <returns>true if succeeded, false if not</returns> private bool StartLidar(ScanMode mode) { // Get health HealthInfo health = lidar.GetHealth(); if (health == null) { return(false); } // Good health ? if (health.Status != HealthStatus.Good) { logger.LogWarning($"Health {health.Status}, error code {health.ErrorCode}."); return(false); } // Good health logger.LogInformation($"Health good."); // Get configuration Configuration config = lidar.GetConfiguration(); if (config == null) { return(false); } // Show configuration logger.LogInformation("Configuration:"); foreach (KeyValuePair <ushort, ScanModeConfiguration> modeConfig in config.Modes) { logger.LogInformation($"0x{modeConfig.Key:X4} - {modeConfig.Value}" + (config.Typical == modeConfig.Key ? " (typical)" : string.Empty)); } // Start motor lidar.ControlMotorDtr(false); // Start scanning if (!lidar.StartScan(mode)) { return(false); } // Report logger.LogInformation("Scanning started."); return(true); }
public void GetHit(float resultingDamage) { CurHP -= resultingDamage; var healthInfo = new HealthInfo { CurHP = this.CurHP, MaxHP = this.MaxHP }; if (dyingSystem.ShouldBeDead(healthInfo)) { dyingSystem.Die(); } }
internal H3Client(ManualLogSource log, ClientConfig config, StatefulActivity discord, PeerMessageList <H3Client> messages, byte channelsCount, double tickDeltaTime, Version version, IPEndPoint endpoint, ConnectionRequestMessage request, OnH3ClientDisconnect onDisconnected) : base(log, messages, channelsCount, new Events(), version, endpoint, x => x.Put(request)) { _log = log; _config = config; _discord = discord; _onDisconnected = onDisconnected; _tickDeltaTime = tickDeltaTime; _tickTimer = new LoopTimer(tickDeltaTime); _players = new Dictionary <byte, Puppet>(); _health = new HealthInfo(HEALTH_INTERVAL, (int)(HEALTH_INTERVAL / PING_INTERVAL)); }
/// <summary> /// Add a health response and aggregate it to the complete health state. /// </summary> /// <param name="healthInfo"></param> public void AddHealthResponse(HealthInfo healthInfo) { _health.Resources.Add(healthInfo); if (healthInfo.Status == HealthInfo.StatusEnum.Warning) { _warnings++; _lastWarningMessage = healthInfo.Message; } if (healthInfo.Status == HealthInfo.StatusEnum.Error) { _errors++; _lastErrorMessage = healthInfo.Message; } }
async Task <HealthInfo> IHealthCheck.Check() { var info = new HealthInfo { ItemName = nameof(MySqlConnectionsManager), Items = new List <HealthItem>() }; var values = ConfigurationHelper.Get <Dictionary <string, string> >("ConnectionStrings"); foreach (var kv in values) { info.Items.Add(await ConnectionTest(kv.Key, kv.Value)); } return(info); }
public DevHealthUnpacker(string sXML) { _healthInfos = new ArrayList(1); TextReader tr = new StringReader(sXML); XmlTextReader xtr = new XmlTextReader(tr); xtr.WhitespaceHandling = WhitespaceHandling.None; xtr.Read(); // read the XML declaration node, advance to <suite> tag while (!xtr.EOF) //load loop { if (xtr.Name == "Subsystem" && !xtr.IsStartElement()) { break; } while (xtr.Name != "Field" || !xtr.IsStartElement()) { xtr.Read(); // advance to <Field> tag } HealthInfo tc = new HealthInfo(); tc.FieldName = xtr.GetAttribute("Name"); tc.Type = xtr.GetAttribute("Type"); tc.Error = xtr.GetAttribute("Error"); if (tc.Error == null) { tc.Error = ""; } tc.Value = xtr.ReadElementString("Field"); // consumes the </arg1> tag // we are now at an </testcase> tag _healthInfos.Add(tc); xtr.Read(); // and now either at <testcase> tag or </suite> tag } // load loop xtr.Close(); }
/// <summary> /// Reads data from a SaveReader. Override this in a derived class to read object-specific data. /// </summary> /// <param name="reader">The SaveReader to read from. No guarantees can be made about its ending offset.</param> /// <param name="baseOffset">The offset of the start of the object data.</param> protected virtual void ReadFrom(SaveReader reader, long baseOffset) { _tag = DatumIndex.ReadFrom(reader); reader.SeekTo(baseOffset + StrengthInfoOffset); _healthInfo = new HealthInfo(reader, DefaultChiefHealthModifier, DefaultChiefShieldModifier, float.MaxValue); // Read Position reader.SeekTo(baseOffset + PositionOffset1); _positionMain.X = reader.ReadFloat(); _positionMain.Y = reader.ReadFloat(); _positionMain.Z = reader.ReadFloat(); // Read Position2 Vector3 position2 = new Vector3(); reader.SeekTo(baseOffset + PositionOffset2); position2.X = reader.ReadFloat(); position2.Y = reader.ReadFloat(); position2.Z = reader.ReadFloat(); // Read Position3 Vector3 position3 = new Vector3(); reader.SeekTo(baseOffset + PositionOffset3); position3.X = reader.ReadFloat(); position3.Y = reader.ReadFloat(); position3.Z = reader.ReadFloat(); // Compute position deltas _position2Delta = Vector3.Subtract(position2, _positionMain); _position3Delta = Vector3.Subtract(position3, _positionMain); reader.SeekTo(baseOffset + CarryInfoOffset); _nextCarriedIndex = DatumIndex.ReadFrom(reader); _firstCarriedIndex = DatumIndex.ReadFrom(reader); _carrierIndex = DatumIndex.ReadFrom(reader); }
public void CompareFaces() { Debug.Log("Compare faces"); var image = CameraDevice.Instance.GetCameraImage(_pixel_format); if (image != null) { byte[] pixels = image.Pixels; dbsr = new DBService("real_data.db"); dbsr.AssertDatabaseExists(); var id_user = FAUtils.getIdConfidenceForCompare(pixels, dbsr); var patient = Patient.GetInfo(dbsr, id_user); var health_info = HealthInfo.GetHealthInfoForPatient(dbsr, id_user); var appointment = Appointment.GetAppointmentsForPatient(dbsr, id_user); var text = GameObject.Find("Patient_Name").GetComponent <TextMesh>(); text.text = patient.FirstName + " " + patient.LastName; text = GameObject.Find("Patient_JMBG").GetComponent <TextMesh>(); text.text = patient.JMBG; text = GameObject.Find("Patient_Age").GetComponent <TextMesh>(); text.text = patient.Age.ToString(); text = GameObject.Find("Patient_Record").GetComponent <TextMesh>(); text.text = patient.MedicalRecordNumber; text = GameObject.Find("Patien_Condition").GetComponent <TextMesh>(); text.text = health_info.Condition; text = GameObject.Find("Patient_BloodType").GetComponent <TextMesh>(); text.text = health_info.BloodType; text = GameObject.Find("Patient_Alergies").GetComponent <TextMesh>(); text.text = health_info.Allergies; text = GameObject.Find("Patient_Title").GetComponent <TextMesh>(); text.text = appointment.First().Title; text = GameObject.Find("Patient_Date").GetComponent <TextMesh>(); text.text = appointment.First().AppointmentDate.ToString("dd.MM.yyyy."); text = GameObject.Find("Patient_Description").GetComponent <TextMesh>(); text.text = appointment.First().Description; } }
public void AddHealthInfo(HealthInfo healthInfo) { if (healthInfo.Id == 0) { _context.HealthInfos.Add(healthInfo); } else { var dbEntry = _context.HealthInfos.Find(healthInfo.Id); if (dbEntry != null) { dbEntry.PatientId = healthInfo.PatientId; dbEntry.DiseaseId = healthInfo.DiseaseId; dbEntry.HeartRate = healthInfo.HeartRate; dbEntry.BloodPressure = healthInfo.BloodPressure; dbEntry.Temperature = healthInfo.Temperature; dbEntry.Weight = healthInfo.Weight; dbEntry.Time = healthInfo.Time; dbEntry.ActivityPoints = healthInfo.ActivityPoints; dbEntry.isFall = healthInfo.isFall; } } _context.SaveChanges(); }
/// <summary> /// Call a health check delegate and aggregate the answer to the complete health state. /// </summary> /// <param name="resourceName">The name to use for the resource</param> /// <param name="healthDelegate">A method that returns a health, that we will add to the aggregated health.</param> /// <param name="cancellationToken"></param> public async Task AddResourceHealthAsync(string resourceName, GetResourceHealthDelegate healthDelegate, CancellationToken cancellationToken = default) { HealthInfo response; try { response = await healthDelegate(Tenant, cancellationToken); //Check this? if (string.IsNullOrWhiteSpace(response.Resource)) { response.Resource = resourceName; } } catch (Exception e) { response = new HealthInfo(resourceName) { Status = HealthInfo.StatusEnum.Error, Message = e.Message }; } AddHealthResponse(response); }
private EndpointHealth FromResult(DateTime checkTimeUtc, TimeSpan responseTime, HealthInfo result) { return new EndpointHealth(checkTimeUtc, responseTime, GetStatus(result.Status, responseTime), result.Details); }
public virtual void Start() { m_health = GetComponent <HealthInfo>(); m_health.Init(this); }
public Enemy1_State_Transition_Func(GameObject player_ref, GameObject enemy1_ref, HealthInfo boss_health_info_ref) { boss_health_info = boss_health_info_ref; player = player_ref; enemy1 = enemy1_ref; }
private EndpointHealth FromResult(DateTime checkTimeUtc, TimeSpan responseTime, HealthInfo result) { return(new EndpointHealth(checkTimeUtc, responseTime, GetStatus(result.Status, responseTime), result.Details)); }
/// <summary> /// Updates regeneration timer /// </summary> /// <param name="info">Shield info to update</param> /// <param name="delta">Time in ms since the last update</param> private void UpdateShieldTimer(HealthInfo info, double delta) { ShieldComponent shield = info.Shield; double value = shield.LastRegeneration + delta; shield.LastRegeneration = Math.Min(value, shield.RegenerationFrequency); }
public void EditHealthInfo(HealthInfo healthInfo) { _context.Entry(healthInfo).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); }
/// <summary> /// Ensures that a HealthInfo instance exists /// </summary> /// <param name="id">Game object id</param> /// <returns>Returns a HealthInfo instance</returns> private HealthInfo EnsureHealthInfo(int id) { HealthInfo info; if (!_healthMap.TryGetValue(id, out info)) { info = new HealthInfo(id); _healthMap.Add(id, info); } return info; }
/// <summary> /// Regenerates the shield /// </summary> /// <param name="info">Shield info</param> private void RegenerateShield(HealthInfo info) { ShieldComponent shield = info.Shield; if (!CanRegenerate(info.Shield)) return; if ((shield.LastRegeneration >= shield.RegenerationFrequency) && (info.LastDamageTimer >= shield.RegenerationDelay)) { shield.Power += shield.Regeneration; shield.LastRegeneration = 0.0d; ShowMessage(ShieldRegenerated, info.GameObjectId, shield.Regeneration); } }