public override void useSkill(List <BattleChar> target) { base.useSkill(target); foreach (BattleChar bc in target) { DamCoef = 1.0f + 0.05f * level; bc.setLastAttack(set.user); ((SkillMage)set).dam = bc.getTarget().SetMagicDamage(set.user, DamCoef, level, coef * set.user.getFinalDamage() * CriticalTest()); if (((MagePassive4)set.pas[3]).isInit) { ((MagePassive4)set.pas[3]).addAttack(bc, ((SkillMage)set).dam); } ((SkillMage)set).lastTarget = bc; if (enemies.Exists(x => x == bc)) { skills.ToArray()[enemies.IndexOf(bc)].setTurn(3); } else { Burn b = new Burn(3, set.user, bc, set.user.GetMgcATK() * (0.2f + 0.03f * level)); enemies.Add(bc); skills.Add(b); bc.stateBurn.Add(b); } } }
private void OnTriggerEnter(Collider other) { Debug.Log("Sword Hit!\nDamage: " + damage + ". slowAmount: " + slowAmount + ". duration: " + duration + ". element: " + element + ".\nTag: " + other.tag); if (other.CompareTag("Player")) { BuffHandler playerBuffHandler = other.GetComponent <BuffHandler>(); StatHandler statHandler = other.GetComponent <StatHandler>(); Buff debuff; switch (element) { case ElementEnum.fire: debuff = new Burn(statHandler, new Stat(duration), damage); playerBuffHandler.AddBuff(debuff); break; case ElementEnum.ice: debuff = new Slow(statHandler, new Stat(duration), new ScalingStatModificator(slowAmount)); statHandler.TakeDamage(damage); playerBuffHandler.AddBuff(debuff); break; case ElementEnum.lightning: debuff = new Stun(statHandler, new Stat(duration)); statHandler.TakeDamage(damage); playerBuffHandler.AddBuff(debuff); break; } } }
public override void Cast_Spell(Summon s) { base.Cast_Spell(s); if(Random.Range(0, 101) > 90) { results += new Burn().Do_Ability(s); } }
private void tSMI_burn_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { Disc wrapper = (Disc)listView1.SelectedItems[0].Tag; Burn burnForm = new Burn(wrapper); burnForm.ShowDialog(); } }
private void OnTriggerEnter(Collider otherObject) { if (this._owner && this._owner != otherObject.transform.root && base.transform.root != otherObject.transform.root) { if (BoltNetwork.isRunning) { GameObject gameObject = otherObject.transform.root.gameObject; BoltEntity component = gameObject.GetComponent<BoltEntity>(); if (component) { switch (this._bonusType) { case WeaponBonus.BonusTypes.Burn: { Burn burn = Burn.Create(GlobalTargets.OnlyServer); burn.Entity = component; burn.Send(); break; } case WeaponBonus.BonusTypes.Poison: if (Vector3.Dot(otherObject.transform.position - base.transform.position, base.transform.forward) > 0.25f) { Poison poison = Poison.Create(GlobalTargets.OnlyServer); poison.Entity = component; poison.Send(); } break; case WeaponBonus.BonusTypes.DouseBurn: { Burn burn2 = Burn.Create(GlobalTargets.OnlyServer); burn2.Entity = component; burn2.Send(); break; } } } } switch (this._bonusType) { case WeaponBonus.BonusTypes.Burn: Prefabs.Instance.SpawnFireHitPS(base.transform.position, Quaternion.LookRotation(base.transform.position - otherObject.transform.position)); otherObject.SendMessage("Burn", SendMessageOptions.DontRequireReceiver); break; case WeaponBonus.BonusTypes.Poison: if (Vector3.Dot(otherObject.transform.position - base.transform.position, base.transform.forward) > 0.25f) { otherObject.SendMessage("Poison", SendMessageOptions.DontRequireReceiver); } break; case WeaponBonus.BonusTypes.DouseBurn: Prefabs.Instance.SpawnFireHitPS(base.transform.position, Quaternion.LookRotation(base.transform.position - otherObject.transform.position)); otherObject.SendMessage("Douse", SendMessageOptions.DontRequireReceiver); otherObject.SendMessage("Burn", SendMessageOptions.DontRequireReceiver); break; } } }
public void RunEffects() { map.selectedEnemy = this.name; GameObject effects = GameObject.Find("Effects"); if (Burned) { // map.selectedEnemy = this.name; // Burn burn = effects.GetComponent <Burn> (); burn.RunBurn(); } if (Slowed) { // map.selectedEnemy = this.name; // GameObject Slow = GameObject.Find ("_Scripts"); Slow slow = effects.GetComponent <Slow> (); slow.RunSlow(); } if (Poisoned) { // map.selectedEnemy = this.name; // GameObject Poison = GameObject.Find ("_Scripts"); Poison poison = effects.GetComponent <Poison> (); poison.RunPoison(); } if (Bleeding) { // map.selectedEnemy = this.name; // GameObject Bleed = GameObject.Find ("_Scripts"); Bleed bleed = effects.GetComponent <Bleed> (); bleed.RunBleed(); } if (Stunned) { // map.selectedEnemy = this.name; // GameObject Stun = GameObject.Find ("_Scripts"); Stun stun = effects.GetComponent <Stun> (); stun.RunStun(); } if (Chilled) { Chill chill = effects.GetComponent <Chill> (); chill.RunChill(); } if (Frozen) { Frozen frozen = effects.GetComponent <Frozen> (); frozen.RunFrozen(); } if (Blinded) { Blind blind = effects.GetComponent <Blind> (); blind.RunBlind(); } }
public IHttpActionResult Post([FromBody] Burn burn) { if (!ModelState.IsValid) { return(BadRequest()); } _burnRepository.AddBurn(burn); return(Ok()); }
public SpellResults Do_Ability(Summon s) { int heal = s.Base_Health / 10 + s.Curse * 5; SpellResults r = new SpellResults(0, 0, heal, 0, 0, 0); //if (Random.Range(0, 101) > 80) r += new Burn().Do_Ability(s); //if (Random.Range(0, 101) > 80) r += new Poison().Do_Ability(s); return r; }
public void zz_Give_Enemy_Burn(int stack) { if (Services.actionManager.currentTargetEnemy != null) { Services.actionManager.currentTargetEnemy.GainNewBuff(new Burn(), stack); int a = Services.actionManager.currentTargetEnemy.CheckBuff(new Burn()); Burn temp = (Burn)Services.actionManager.currentTargetEnemy.enemyBuffList[a]; temp.TakeDamage(); } }
public override int GetHashCode() { unchecked { var hashCode = Brute.GetHashCode(); hashCode = (hashCode * 397) ^ Burn.GetHashCode(); hashCode = (hashCode * 397) ^ Toxin.GetHashCode(); hashCode = (hashCode * 397) ^ Suffocation.GetHashCode(); return(hashCode); } }
public void UpdateBurn(Burn burn) { Throw.IfNull(burn, nameof(burn)); using (ApplicationDbContext db = new ApplicationDbContext()) { db.Burns.Attach(burn); db.Entry(burn).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
public void Reset(NavigationManoeuvre manoeuvre) { Burn burn = manoeuvre.burn; Δv_tangent_.value = burn.delta_v.x; Δv_normal_.value = burn.delta_v.y; Δv_binormal_.value = burn.delta_v.z; initial_time_.value = burn.initial_time; reference_frame_selector_.Reset(burn.frame); duration_ = manoeuvre.duration; initial_mass_in_tonnes_ = manoeuvre.initial_mass_in_tonnes; }
public void Reset(NavigationManoeuvre manœuvre) { Burn burn = manœuvre.burn; Δv_tangent_.value = burn.delta_v.x; Δv_normal_.value = burn.delta_v.y; Δv_binormal_.value = burn.delta_v.z; initial_time_ = burn.initial_time; reference_frame_selector_.SetFrameParameters(burn.frame); is_inertially_fixed_ = burn.is_inertially_fixed; duration_ = manœuvre.duration; initial_mass_in_tonnes_ = manœuvre.initial_mass_in_tonnes; }
private void PnChangeHandle(string pn) { ResetUi(); _burn = new Burn(pn, _i2cDevice); _burn.OnXmlGet += _burn_OnXmlGet; _burn.OnPortRead += _burn_OnPortRead; _burn.OnPortWrite += _burn_OnPortWrite; _burn.OnI2CDeviceClose += _burn_OnI2CDeviceClose; _burn.OnI2CDeviceOpen += _burn_OnI2CDeviceOpen; _burn.OnProgressChange += _burn_OnProgressChange; _burn.DownloadConfig(); AddStatus("料号档案下载成功"); GetPnConfig(pn); }
public void WriteDataTest() { string pn = "aa"; string folder = @"B:\"; //Ii2c aa=new CP2112(1,20,8); Ii2c bb = new LuxshareIi2C("COM20", 8, 20); Burn burn = new Burn(pn, bb, folder); var data = new byte[1][]; var readData = burn.WriteData(data); Assert.Fail(); }
public void AddBurn(Burn burn) { // Throw.IfNullOrWhiteSpace(name, "Name cannot be null or whitespace"); using (ApplicationDbContext db = new ApplicationDbContext()) { db.Burns.Add(new Burn { Name = burn.Name, Calories = burn.Calories, Time = burn.Time }); db.SaveChanges(); } }
public IHttpActionResult Update([FromBody] Burn burn) { if (!ModelState.IsValid) { return(BadRequest()); } var updated = _burnRepository.UpdateBurnbool(burn); if (!updated) { return(NotFound()); } return(Ok()); }
private void OnCollisionEnter(Collision collision) { Physics.IgnoreLayerCollision(12, 8); GameObject other = collision.gameObject; if (other != null) { if (other.CompareTag("Player")) { BuffHandler playerBuffHandler = other.GetComponent <BuffHandler>(); StatHandler statHandler = other.GetComponent <StatHandler>(); Buff debuff; switch (element) { case ElementEnum.fire: debuff = new Burn(statHandler, new Stat(duration), damage); playerBuffHandler.AddBuff(debuff); break; case ElementEnum.ice: debuff = new Slow(statHandler, new Stat(duration), new ScalingStatModificator(slowAmount)); statHandler.TakeDamage(damage); playerBuffHandler.AddBuff(debuff); break; case ElementEnum.lightning: debuff = new Stun(statHandler, new Stat(duration)); statHandler.TakeDamage(damage); playerBuffHandler.AddBuff(debuff); break; } Destroy(gameObject); } Destroy(gameObject); } else if (other.gameObject.CompareTag("Untagged")) { // Debug.Log("Projectile collide with ELSE: " + other.gameObject.name); Destroy(gameObject); } else { // Debug.Log("Projectile collide with: " + other.gameObject.name); } }
public bool UpdateBurnbool(Burn burn) { Throw.IfNull(burn, nameof(burn)); bool updatebool = false; using (ApplicationDbContext db = new ApplicationDbContext()) { try { db.Burns.Attach(burn); db.Entry(burn).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); updatebool = true; } catch { } } return(updatebool); }
public override void OnEvent(Burn evnt) { if (evnt.Entity) { if (evnt.Entity.StateIs <IMutantState>()) { EnemyHealth[] componentsInChildren = evnt.Entity.GetComponentsInChildren <EnemyHealth>(true); if (componentsInChildren.Length > 0) { componentsInChildren[0].Burn(); } } else if (evnt.Entity.StateIs <IAnimalState>()) { animalHealth[] componentsInChildren2 = evnt.Entity.GetComponentsInChildren <animalHealth>(true); if (componentsInChildren2.Length > 0) { componentsInChildren2[0].Burn(); } } } }
private void OnTriggerEnter(Collider other) { if (this.rootTr != other.transform.root) { other.SendMessage("Douse", this, SendMessageOptions.DontRequireReceiver); other.SendMessage("Burn", this, SendMessageOptions.DontRequireReceiver); if (BoltNetwork.isClient) { BoltEntity boltEntity = other.transform.GetComponent <BoltEntity>(); if (boltEntity == null) { boltEntity = other.transform.GetComponentInParent <BoltEntity>(); } if (boltEntity) { Burn burn = Burn.Create(GlobalTargets.OnlyServer); burn.Entity = boltEntity; burn.Send(); } } } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { BuffHandler playerBuffHandler = other.GetComponent <BuffHandler>(); StatHandler statHandler = other.GetComponent <StatHandler>(); Buff debuff; switch (element) { case ElementEnum.fire: debuff = new Burn(statHandler, new Stat(duration), damage); playerBuffHandler.AddBuff(debuff); break; case ElementEnum.ice: debuff = new Slow(statHandler, new Stat(duration), new ScalingStatModificator(slowAmount)); statHandler.TakeDamage(damage); playerBuffHandler.AddBuff(debuff); break; case ElementEnum.lightning: debuff = new Stun(statHandler, new Stat(duration)); statHandler.TakeDamage(damage); playerBuffHandler.AddBuff(debuff); break; } } else if (other.CompareTag("Projectile")) { Debug.Log("SHIELD ENTER PROJECTILE: " + other.gameObject.transform); Destroy(other.gameObject); } }
private void RenderPlanner(int window_id) { var old_skin = UnityEngine.GUI.skin; UnityEngine.GUI.skin = null; UnityEngine.GUILayout.BeginVertical(); if (vessel_ == null || vessel_ != FlightGlobals.ActiveVessel || !plugin_.HasVessel(vessel_.id.ToString())) { Reset(); } if (vessel_ != null) { string vessel_guid = vessel_.id.ToString(); if (burn_editors_ == null) { if (plugin_.HasVessel(vessel_guid)) { if (plugin_.FlightPlanExists(vessel_guid)) { burn_editors_ = new List <BurnEditor>(); for (int i = 0; i < plugin_.FlightPlanNumberOfManoeuvres(vessel_guid); ++i) { // Dummy initial time, we call |Reset| immediately afterwards. final_time_.value = plugin_.FlightPlanGetFinalTime(vessel_guid); burn_editors_.Add( new BurnEditor(adapter_, plugin_, vessel_, initial_time: 0)); burn_editors_.Last().Reset( plugin_.FlightPlanGetManoeuvre(vessel_guid, i)); } } else { if (UnityEngine.GUILayout.Button("Create flight plan")) { plugin_.FlightPlanCreate(vessel_guid, plugin_.CurrentTime() + 1000, vessel_.GetTotalMass()); final_time_.value = plugin_.FlightPlanGetFinalTime(vessel_guid); Shrink(); } } } } else { if (final_time_.Render(enabled: true)) { plugin_.FlightPlanSetFinalTime(vessel_guid, final_time_.value); final_time_.value = plugin_.FlightPlanGetFinalTime(vessel_guid); } AdaptiveStepParameters parameters = plugin_.FlightPlanGetAdaptiveStepParameters(vessel_guid); UnityEngine.GUILayout.BeginHorizontal(); UnityEngine.GUILayout.Label("Maximal step count per segment", UnityEngine.GUILayout.Width(150)); if (parameters.max_steps <= 100) { UnityEngine.GUILayout.Button("min"); } else if (UnityEngine.GUILayout.Button("-")) { parameters.max_steps /= 10; plugin_.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); } UnityEngine.GUILayout.TextArea(parameters.max_steps.ToString(), UnityEngine.GUILayout.Width(150)); if (parameters.max_steps >= Int64.MaxValue / 10) { UnityEngine.GUILayout.Button("max"); } else if (UnityEngine.GUILayout.Button("+")) { parameters.max_steps *= 10; plugin_.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); } UnityEngine.GUILayout.EndHorizontal(); UnityEngine.GUILayout.BeginHorizontal(); UnityEngine.GUILayout.Label("Tolerance", UnityEngine.GUILayout.Width(150)); if (parameters.length_integration_tolerance <= 1e-6) { UnityEngine.GUILayout.Button("min"); } else if (UnityEngine.GUILayout.Button("-")) { parameters.length_integration_tolerance /= 2; parameters.speed_integration_tolerance /= 2; plugin_.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); } UnityEngine.GUILayout.TextArea( parameters.length_integration_tolerance.ToString("0.0e0") + " m", UnityEngine.GUILayout.Width(150)); if (parameters.length_integration_tolerance >= 1e6) { UnityEngine.GUILayout.Button("max"); } else if (UnityEngine.GUILayout.Button("+")) { parameters.length_integration_tolerance *= 2; parameters.speed_integration_tolerance *= 2; plugin_.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); } UnityEngine.GUILayout.EndHorizontal(); double Δv = (from burn_editor in burn_editors_ select burn_editor.Δv()).Sum(); UnityEngine.GUILayout.Label( "Total Δv : " + Δv.ToString("0.000") + " m/s"); if (burn_editors_.Count == 0 && UnityEngine.GUILayout.Button("Delete flight plan")) { plugin_.FlightPlanDelete(vessel_guid); Reset(); } else { if (burn_editors_.Count > 0) { RenderUpcomingEvents(); } for (int i = 0; i < burn_editors_.Count - 1; ++i) { UnityEngine.GUILayout.TextArea("Manœuvre #" + (i + 1) + ":"); burn_editors_[i].Render(enabled: false); } if (burn_editors_.Count > 0) { BurnEditor last_burn = burn_editors_.Last(); UnityEngine.GUILayout.TextArea("Editing manœuvre #" + (burn_editors_.Count) + ":"); if (last_burn.Render(enabled: true)) { plugin_.FlightPlanReplaceLast(vessel_guid, last_burn.Burn()); last_burn.Reset( plugin_.FlightPlanGetManoeuvre(vessel_guid, burn_editors_.Count - 1)); } if (UnityEngine.GUILayout.Button( "Delete last manœuvre", UnityEngine.GUILayout.ExpandWidth(true))) { plugin_.FlightPlanRemoveLast(vessel_guid); burn_editors_.Last().Close(); burn_editors_.RemoveAt(burn_editors_.Count - 1); Shrink(); } } if (UnityEngine.GUILayout.Button( "Add manœuvre", UnityEngine.GUILayout.ExpandWidth(true))) { double initial_time; if (burn_editors_.Count == 0) { initial_time = plugin_.CurrentTime() + 60; } else { initial_time = plugin_.FlightPlanGetManoeuvre( vessel_guid, burn_editors_.Count - 1).final_time + 60; } var editor = new BurnEditor(adapter_, plugin_, vessel_, initial_time); Burn candidate_burn = editor.Burn(); bool inserted = plugin_.FlightPlanAppend(vessel_guid, candidate_burn); if (inserted) { editor.Reset(plugin_.FlightPlanGetManoeuvre(vessel_guid, burn_editors_.Count)); burn_editors_.Add(editor); } Shrink(); } } } } UnityEngine.GUILayout.EndVertical(); UnityEngine.GUI.DragWindow( position: new UnityEngine.Rect(x: 0f, y: 0f, width: 10000f, height: 10000f)); UnityEngine.GUI.skin = old_skin; }
private void RenderFlightPlan(string vessel_guid) { using (new UnityEngine.GUILayout.VerticalScope()) { if (final_time_.Render(enabled: true)) { var status = plugin.FlightPlanSetDesiredFinalTime(vessel_guid, final_time_.value); UpdateStatus(status, null); final_time_.value = plugin.FlightPlanGetDesiredFinalTime(vessel_guid); } FlightPlanAdaptiveStepParameters parameters = plugin.FlightPlanGetAdaptiveStepParameters(vessel_guid); using (new UnityEngine.GUILayout.HorizontalScope()) { using (new UnityEngine.GUILayout.HorizontalScope()) { UnityEngine.GUILayout.Label("Max. steps per segment:", GUILayoutWidth(6)); const int factor = 4; if (parameters.max_steps <= 100) { UnityEngine.GUILayout.Button("min"); } else if (UnityEngine.GUILayout.Button("-")) { parameters.max_steps /= factor; var status = plugin.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); UpdateStatus(status, null); } UnityEngine.GUILayout.TextArea(parameters.max_steps.ToString(), GUILayoutWidth(3)); if (parameters.max_steps >= long.MaxValue / factor) { UnityEngine.GUILayout.Button("max"); } else if (UnityEngine.GUILayout.Button("+")) { parameters.max_steps *= factor; var status = plugin.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); UpdateStatus(status, null); } } using (new UnityEngine.GUILayout.HorizontalScope()) { UnityEngine.GUILayout.Label("Tolerance:", GUILayoutWidth(3)); if (parameters.length_integration_tolerance <= 1e-6) { UnityEngine.GUILayout.Button("min"); } else if (UnityEngine.GUILayout.Button("-")) { parameters.length_integration_tolerance /= 2; parameters.speed_integration_tolerance /= 2; var status = plugin.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); UpdateStatus(status, null); } UnityEngine.GUILayout.TextArea( parameters.length_integration_tolerance.ToString("0.0e0") + " m", GUILayoutWidth(3)); if (parameters.length_integration_tolerance >= 1e6) { UnityEngine.GUILayout.Button("max"); } else if (UnityEngine.GUILayout.Button("+")) { parameters.length_integration_tolerance *= 2; parameters.speed_integration_tolerance *= 2; var status = plugin.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); UpdateStatus(status, null); } } } double Δv = (from burn_editor in burn_editors_ select burn_editor.Δv()).Sum(); UnityEngine.GUILayout.Label( "Total Δv : " + Δv.ToString("0.000") + " m/s"); { var style = Style.Warning(Style.Multiline(UnityEngine.GUI.skin.label)); string message = GetStatusMessage(); // Size the label explicitly so that it doesn't decrease when the // message goes away: that causes annoying flicker. The enclosing // window has a width of 20 units, but not all of that is available, // hence 19. warning_height_ = Math.Max( warning_height_, style.CalcHeight(new UnityEngine.GUIContent(message), Width(19))); UnityEngine.GUILayout.Label( message, style, UnityEngine.GUILayout.Height(warning_height_)); } if (burn_editors_.Count == 0 && UnityEngine.GUILayout.Button("Delete flight plan")) { plugin.FlightPlanDelete(vessel_guid); ResetStatus(); Shrink(); // The state change will happen the next time we go through OnGUI. } else { if (burn_editors_.Count > 0) { RenderUpcomingEvents(); } // Compute the final times for each manœuvre before displaying them. var final_times = new List <double>(); for (int i = 0; i < burn_editors_.Count - 1; ++i) { final_times.Add( plugin.FlightPlanGetManoeuvre(vessel_guid, i + 1). burn.initial_time); } final_times.Add(plugin.FlightPlanGetActualFinalTime(vessel_guid)); int number_of_anomalous_manœuvres = plugin.FlightPlanNumberOfAnomalousManoeuvres(vessel_guid); for (int i = 0; i < burn_editors_.Count; ++i) { Style.HorizontalLine(); BurnEditor burn = burn_editors_[i]; if (burn.Render(header : "Manœuvre #" + (i + 1), anomalous : i >= (burn_editors_.Count - number_of_anomalous_manœuvres), burn_final_time : final_times[i])) { var status = plugin.FlightPlanReplace(vessel_guid, burn.Burn(), i); UpdateStatus(status, i); burn.Reset(plugin.FlightPlanGetManoeuvre(vessel_guid, i)); } } if (burn_editors_.Count > 0) { if (UnityEngine.GUILayout.Button( "Delete last manœuvre", UnityEngine.GUILayout.ExpandWidth(true))) { var status = plugin.FlightPlanRemoveLast(vessel_guid); UpdateStatus(status, null); burn_editors_.Last().Close(); burn_editors_.RemoveAt(burn_editors_.Count - 1); Shrink(); } } if (UnityEngine.GUILayout.Button( "Add manœuvre", UnityEngine.GUILayout.ExpandWidth(true))) { double initial_time; if (burn_editors_.Count == 0) { initial_time = plugin.CurrentTime() + 60; } else { initial_time = plugin.FlightPlanGetManoeuvre( vessel_guid, burn_editors_.Count - 1).final_time + 60; } var editor = new BurnEditor(adapter_, vessel_, initial_time, index: burn_editors_.Count, previous_burn: burn_editors_.LastOrDefault()); Burn candidate_burn = editor.Burn(); var status = plugin.FlightPlanAppend(vessel_guid, candidate_burn); // The previous call did not necessarily create a manœuvre. Check if // we need to add an editor. int number_of_manœuvres = plugin.FlightPlanNumberOfManoeuvres(vessel_guid); if (number_of_manœuvres > burn_editors_.Count) { editor.Reset(plugin.FlightPlanGetManoeuvre( vessel_guid, number_of_manœuvres - 1)); burn_editors_.Add(editor); UpdateStatus(status, number_of_manœuvres - 1); } else { UpdateStatus(status, number_of_manœuvres); } Shrink(); } } } }
public SausageBurnAction(Burn burn) { this.burn = burn; _sausage = burn.gameObject.GetComponentInParent <Sausage>(); }
private void OnTriggerEnter(Collider otherObject) { if (this._owner && this._owner != otherObject.transform.root && base.transform.root != otherObject.transform.root) { if (BoltNetwork.isRunning) { GameObject gameObject = otherObject.transform.root.gameObject; BoltEntity component = gameObject.GetComponent <BoltEntity>(); if (component) { WeaponBonus.BonusTypes bonusType = this._bonusType; if (bonusType != WeaponBonus.BonusTypes.Burn) { if (bonusType != WeaponBonus.BonusTypes.Poison) { if (bonusType == WeaponBonus.BonusTypes.DouseBurn) { Burn burn = Burn.Create(GlobalTargets.OnlyServer); burn.Entity = component; burn.Send(); } } else if (Vector3.Dot(otherObject.transform.position - base.transform.position, base.transform.forward) > 0.25f) { Poison poison = Poison.Create(GlobalTargets.OnlyServer); poison.Entity = component; poison.Send(); } } else { Burn burn2 = Burn.Create(GlobalTargets.OnlyServer); burn2.Entity = component; burn2.Send(); } } } WeaponBonus.BonusTypes bonusType2 = this._bonusType; if (bonusType2 != WeaponBonus.BonusTypes.Poison) { if (bonusType2 != WeaponBonus.BonusTypes.DouseBurn) { if (bonusType2 == WeaponBonus.BonusTypes.Burn) { Prefabs.Instance.SpawnFireHitPS(base.transform.position, Quaternion.LookRotation(base.transform.position - otherObject.transform.position)); otherObject.SendMessage("Burn", SendMessageOptions.DontRequireReceiver); this._onHit.Invoke(); } } else { Prefabs.Instance.SpawnFireHitPS(base.transform.position, Quaternion.LookRotation(base.transform.position - otherObject.transform.position)); otherObject.SendMessage("Douse", SendMessageOptions.DontRequireReceiver); otherObject.SendMessage("Burn", SendMessageOptions.DontRequireReceiver); this._onHit.Invoke(); } } else if (otherObject.CompareTag("enemyRoot") || otherObject.CompareTag("enemyCollide") || otherObject.CompareTag("animalCollide") || otherObject.CompareTag("animalRoot")) { otherObject.SendMessage("Poison", SendMessageOptions.DontRequireReceiver); this._onHit.Invoke(); } else if (Vector3.Dot(otherObject.transform.position - base.transform.position, base.transform.forward) > 0.25f) { otherObject.SendMessage("Poison", SendMessageOptions.DontRequireReceiver); this._onHit.Invoke(); } } }
private bool RenderCoast(int index) { string vessel_guid = predicted_vessel.id.ToString(); using (new UnityEngine.GUILayout.HorizontalScope()) { double start_of_coast = index == 0 ? plugin.FlightPlanGetInitialTime(vessel_guid) : burn_editors_[index - 1].final_time; string coast_description = index == burn_editors_.Count ? "Final trajectory" : $@"Coast for { (burn_editors_[index].initial_time - start_of_coast).FormatDuration(show_seconds : false)}"; UnityEngine.GUILayout.Label(coast_description); if (UnityEngine.GUILayout.Button("Add manœuvre", GUILayoutWidth(4))) { double initial_time; if (index == 0) { initial_time = plugin.CurrentTime() + 60; } else { initial_time = plugin.FlightPlanGetManoeuvre(vessel_guid, index - 1).final_time + 60; } var editor = new BurnEditor( adapter_, predicted_vessel, initial_time, index, get_burn_at_index: burn_editors_.ElementAtOrDefault); editor.minimized = false; Burn candidate_burn = editor.Burn(); var status = plugin.FlightPlanInsert( vessel_guid, candidate_burn, index); // The previous call did not necessarily create a manœuvre. Check if // we need to add an editor. int number_of_manœuvres = plugin.FlightPlanNumberOfManoeuvres(vessel_guid); if (number_of_manœuvres > burn_editors_.Count) { editor.Reset(plugin.FlightPlanGetManoeuvre( vessel_guid, index)); burn_editors_.Insert(index, editor); UpdateBurnEditorIndices(); UpdateStatus(status, index); Shrink(); return(true); } // TODO(phl): The error messaging here will be either confusing or // wrong. The messages should mention the new manœuvre without // numbering it, since the numbering has not changed (“the new manœuvre // would overlap with manœuvre #1 or manœuvre #2” or something along // these lines). UpdateStatus(status, index); } } return(false); }
private void OnEntityBurn(Burn e) { HookCalled("OnEntityBurn"); // TODO: Show entity info }
public bool Equals(Damage other) { return(Brute.Equals(other.Brute) && Burn.Equals(other.Burn) && Toxin.Equals(other.Toxin) && Suffocation.Equals(other.Suffocation)); }
void Awake() { S = this; }
private void RenderFlightPlan(string vessel_guid) { using (new UnityEngine.GUILayout.VerticalScope()) { if (final_time_.Render(enabled: true)) { plugin.FlightPlanSetDesiredFinalTime(vessel_guid, final_time_.value); final_time_.value = plugin.FlightPlanGetDesiredFinalTime(vessel_guid); } double actual_final_time = plugin.FlightPlanGetActualFinalTime(vessel_guid); FlightPlanAdaptiveStepParameters parameters = plugin.FlightPlanGetAdaptiveStepParameters(vessel_guid); using (new UnityEngine.GUILayout.HorizontalScope()) { using (new UnityEngine.GUILayout.HorizontalScope()) { UnityEngine.GUILayout.Label("Max. steps per segment:", GUILayoutWidth(6)); const int factor = 4; if (parameters.max_steps <= 100) { UnityEngine.GUILayout.Button("min"); } else if (UnityEngine.GUILayout.Button("-")) { parameters.max_steps /= factor; plugin.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); } UnityEngine.GUILayout.TextArea(parameters.max_steps.ToString(), GUILayoutWidth(3)); if (parameters.max_steps >= Int64.MaxValue / factor) { UnityEngine.GUILayout.Button("max"); } else if (UnityEngine.GUILayout.Button("+")) { parameters.max_steps *= factor; plugin.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); } } using (new UnityEngine.GUILayout.HorizontalScope()) { UnityEngine.GUILayout.Label("Tolerance:", GUILayoutWidth(3)); if (parameters.length_integration_tolerance <= 1e-6) { UnityEngine.GUILayout.Button("min"); } else if (UnityEngine.GUILayout.Button("-")) { parameters.length_integration_tolerance /= 2; parameters.speed_integration_tolerance /= 2; plugin.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); } UnityEngine.GUILayout.TextArea( parameters.length_integration_tolerance.ToString("0.0e0") + " m", GUILayoutWidth(3)); if (parameters.length_integration_tolerance >= 1e6) { UnityEngine.GUILayout.Button("max"); } else if (UnityEngine.GUILayout.Button("+")) { parameters.length_integration_tolerance *= 2; parameters.speed_integration_tolerance *= 2; plugin.FlightPlanSetAdaptiveStepParameters(vessel_guid, parameters); } } } double Δv = (from burn_editor in burn_editors_ select burn_editor.Δv()).Sum(); UnityEngine.GUILayout.Label( "Total Δv : " + Δv.ToString("0.000") + " m/s"); string message = ""; if (final_time_.value != actual_final_time) { message = "Timed out after " + FormatPositiveTimeSpan(TimeSpan.FromSeconds( actual_final_time - plugin.FlightPlanGetInitialTime(vessel_guid))); } UnityEngine.GUILayout.Label( message, Style.Warning(UnityEngine.GUI.skin.label)); if (burn_editors_.Count == 0 && UnityEngine.GUILayout.Button("Delete flight plan")) { plugin.FlightPlanDelete(vessel_guid); Shrink(); // The state change will happen the next time we go through OnGUI. } else { if (burn_editors_.Count > 0) { RenderUpcomingEvents(); } for (int i = 0; i < burn_editors_.Count - 1; ++i) { Style.HorizontalLine(); burn_editors_[i].Render(header: "Manœuvre #" + (i + 1), enabled: false); } if (burn_editors_.Count > 0) { Style.HorizontalLine(); BurnEditor last_burn = burn_editors_.Last(); if (last_burn.Render(header: "Editing manœuvre #" + (burn_editors_.Count), enabled: true, actual_final_time: actual_final_time)) { plugin.FlightPlanReplaceLast(vessel_guid, last_burn.Burn()); last_burn.Reset( plugin.FlightPlanGetManoeuvre(vessel_guid, burn_editors_.Count - 1)); } if (UnityEngine.GUILayout.Button( "Delete last manœuvre", UnityEngine.GUILayout.ExpandWidth(true))) { plugin.FlightPlanRemoveLast(vessel_guid); burn_editors_.Last().Close(); burn_editors_.RemoveAt(burn_editors_.Count - 1); Shrink(); } } if (UnityEngine.GUILayout.Button( "Add manœuvre", UnityEngine.GUILayout.ExpandWidth(true))) { double initial_time; if (burn_editors_.Count == 0) { initial_time = plugin.CurrentTime() + 60; } else { initial_time = plugin.FlightPlanGetManoeuvre( vessel_guid, burn_editors_.Count - 1).final_time + 60; } var editor = new BurnEditor(adapter_, vessel_, initial_time, index: burn_editors_.Count, previous_burn: burn_editors_.LastOrDefault()); Burn candidate_burn = editor.Burn(); bool inserted = plugin.FlightPlanAppend(vessel_guid, candidate_burn); if (inserted) { editor.Reset(plugin.FlightPlanGetManoeuvre( vessel_guid, burn_editors_.Count)); burn_editors_.Add(editor); } Shrink(); } } } }
public override void OnEvent(Burn evnt) { if (evnt.Entity) { if (evnt.Entity.StateIs<IMutantState>()) { EnemyHealth[] componentsInChildren = evnt.Entity.GetComponentsInChildren<EnemyHealth>(true); if (componentsInChildren.Length > 0) { componentsInChildren[0].Burn(); } } else if (evnt.Entity.StateIs<IAnimalState>()) { animalHealth[] componentsInChildren2 = evnt.Entity.GetComponentsInChildren<animalHealth>(true); if (componentsInChildren2.Length > 0) { componentsInChildren2[0].Burn(); } } } }
private bool RenderCoast(int index, out double?orbital_period) { string vessel_guid = predicted_vessel.id.ToString(); var coast_analysis = plugin.FlightPlanGetCoastAnalysis( vessel_guid, revolutions_per_cycle: null, days_per_cycle: null, ground_track_revolution: 0, index); string orbit_description = null; orbital_period = coast_analysis.elements?.nodal_period; if (coast_analysis.primary_index.HasValue) { var primary = FlightGlobals.Bodies[coast_analysis.primary_index.Value]; int?nodal_revolutions = (int?)(coast_analysis.mission_duration / coast_analysis.elements?.nodal_period); orbit_description = OrbitAnalyser.OrbitDescription( primary, coast_analysis.elements, coast_analysis.recurrence, coast_analysis.ground_track, nodal_revolutions); } using (new UnityEngine.GUILayout.HorizontalScope()) { if (index == burn_editors_.Count) { final_trajectory_analyser_.index = index; final_trajectory_analyser_.RenderButton(); } else { double start_of_coast = index == 0 ? plugin.FlightPlanGetInitialTime( vessel_guid) : burn_editors_[index - 1].final_time; string coast_duration = (burn_editors_[index].initial_time - start_of_coast).FormatDuration( show_seconds: false); string coast_description = orbit_description == null ? L10N.CacheFormat( "#Principia_FlightPlan_Coast", coast_duration) : L10N.CacheFormat( "#Principia_FlightPlan_CoastInOrbit", orbit_description, coast_duration); UnityEngine.GUILayout.Label(coast_description); } if (UnityEngine.GUILayout.Button( L10N.CacheFormat("#Principia_FlightPlan_AddManœuvre"), GUILayoutWidth(4))) { double initial_time; if (index == 0) { initial_time = plugin.CurrentTime() + 60; } else { initial_time = plugin.FlightPlanGetManoeuvre(vessel_guid, index - 1).final_time + 60; } var editor = new BurnEditor(adapter_, predicted_vessel, initial_time, index, get_burn_at_index: burn_editors_. ElementAtOrDefault); editor.minimized = false; Burn candidate_burn = editor.Burn(); var status = plugin.FlightPlanInsert( vessel_guid, candidate_burn, index); // The previous call did not necessarily create a manœuvre. Check if // we need to add an editor. int number_of_manœuvres = plugin.FlightPlanNumberOfManoeuvres(vessel_guid); if (number_of_manœuvres > burn_editors_.Count) { editor.Reset(plugin.FlightPlanGetManoeuvre(vessel_guid, index)); burn_editors_.Insert(index, editor); UpdateBurnEditorIndices(); UpdateStatus(status, index); Shrink(); return(true); } // TODO(phl): The error messaging here will be either confusing or // wrong. The messages should mention the new manœuvre without // numbering it, since the numbering has not changed (“the new manœuvre // would overlap with manœuvre #1 or manœuvre #2” or something along // these lines). UpdateStatus(status, index); } } return(false); }
private void RenderPlanner(int window_id) { var old_skin = UnityEngine.GUI.skin; UnityEngine.GUI.skin = null; UnityEngine.GUILayout.BeginVertical(); if (vessel_ == null || vessel_ != FlightGlobals.ActiveVessel || !plugin_.HasVessel(vessel_.id.ToString())) { Reset(); } if (vessel_ != null) { string vessel_guid = vessel_.id.ToString(); if (burn_editors_ == null) { if (plugin_.HasVessel(vessel_guid)) { if (plugin_.FlightPlanExists(vessel_guid)) { burn_editors_ = new List <BurnEditor>(); for (int i = 0; i < plugin_.FlightPlanNumberOfManoeuvres(vessel_guid); ++i) { // Dummy initial time, we call |Reset| immediately afterwards. final_time_.value = plugin_.FlightPlanGetFinalTime(vessel_guid); burn_editors_.Add( new BurnEditor(adapter_, plugin_, vessel_, initial_time: 0)); burn_editors_.Last().Reset( plugin_.FlightPlanGetManoeuvre(vessel_guid, i)); } } else { if (UnityEngine.GUILayout.Button("Create flight plan")) { plugin_.FlightPlanCreate(vessel_guid, plugin_.CurrentTime() + 1000, vessel_.GetTotalMass()); final_time_.value = plugin_.FlightPlanGetFinalTime(vessel_guid); Shrink(); } } } } else { if (final_time_.Render(enabled: true)) { plugin_.FlightPlanSetFinalTime(vessel_guid, final_time_.value); final_time_.value = plugin_.FlightPlanGetFinalTime(vessel_guid); } if (UnityEngine.GUILayout.Button("Delete flight plan")) { plugin_.FlightPlanDelete(vessel_guid); Reset(); } else { if (burn_editors_.Count > 0) { RenderUpcomingEvents(); } for (int i = 0; i < burn_editors_.Count - 1; ++i) { UnityEngine.GUILayout.TextArea("Manœuvre #" + (i + 1) + ":"); burn_editors_[i].Render(enabled: false); } if (burn_editors_.Count > 0) { BurnEditor last_burn = burn_editors_.Last(); UnityEngine.GUILayout.TextArea("Editing manœuvre #" + (burn_editors_.Count) + ":"); if (last_burn.Render(enabled: true)) { plugin_.FlightPlanReplaceLast(vessel_guid, last_burn.Burn()); last_burn.Reset( plugin_.FlightPlanGetManoeuvre(vessel_guid, burn_editors_.Count - 1)); } if (UnityEngine.GUILayout.Button( "Delete last manœuvre", UnityEngine.GUILayout.ExpandWidth(true))) { plugin_.FlightPlanRemoveLast(vessel_guid); burn_editors_.Last().Close(); burn_editors_.RemoveAt(burn_editors_.Count - 1); Shrink(); } } if (UnityEngine.GUILayout.Button( "Add manœuvre", UnityEngine.GUILayout.ExpandWidth(true))) { double initial_time; if (burn_editors_.Count == 0) { initial_time = plugin_.CurrentTime() + 60; } else { initial_time = plugin_.FlightPlanGetManoeuvre( vessel_guid, burn_editors_.Count - 1).final_time + 60; } var editor = new BurnEditor(adapter_, plugin_, vessel_, initial_time); Burn candidate_burn = editor.Burn(); bool inserted = plugin_.FlightPlanAppend(vessel_guid, candidate_burn); if (inserted) { editor.Reset(plugin_.FlightPlanGetManoeuvre(vessel_guid, burn_editors_.Count)); burn_editors_.Add(editor); } Shrink(); } } } } UnityEngine.GUILayout.EndVertical(); UnityEngine.GUI.DragWindow( position: new UnityEngine.Rect(left: 0f, top: 0f, width: 10000f, height: 10000f)); UnityEngine.GUI.skin = old_skin; }