public static void CohortDied(object sender, DeathEventArgs eventArgs) { PlugInType disturbanceType = eventArgs.DisturbanceType; PoolPercentages cohortReductions = Module.Parameters.CohortReductions[disturbanceType]; ICohort cohort = eventArgs.Cohort; ActiveSite site = eventArgs.Site; float foliar = cohort.LeafBiomass; float wood = cohort.WoodBiomass; float foliarInput = ReduceInput(foliar, cohortReductions.Foliar, site); float woodInput = ReduceInput(wood, cohortReductions.Wood, site); //UI.WriteLine("EVENT: Cohort Died: species={0}, age={1}, disturbance={2}.", cohort.Species.Name, cohort.Age, eventArgs.DisturbanceType); //UI.WriteLine(" Cohort Reductions: Foliar={0:0.00}. Wood={1:0.00}.", cohortReductions.Foliar, cohortReductions.Wood); //UI.WriteLine(" InputB/TotalB: Foliar={0:0.00}/{1:0.00}, Wood={2:0.0}/{3:0.0}.", foliarInput, foliar, woodInput, wood); ForestFloor.AddWoodLitter(woodInput, cohort.Species, site); ForestFloor.AddFoliageLitter(foliarInput, cohort.Species, site); Roots.AddCoarseRootLitter(Roots.CalculateCoarseRoot(wood), cohort.Species, site); // All of cohorts roots are killed. Roots.AddFineRootLitter(Roots.CalculateFineRoot(foliar), cohort.Species, site); }
public override void OnDeath(DeathEventArgs e) { base.OnDeath(e); nameLabel.Dispose(); nameLabel = null; }
//--------------------------------------------------------------------- public void DeathNotExpected(object sender, DeathEventArgs eventArgs) { ICohort cohort = eventArgs.Cohort; Assert.Fail("A cohort died unexpectedly: {0} age={1} biomass={2}", cohort.Species, cohort.Age, cohort.Biomass); }
public void Init(object sender, DeathEventArgs e) { try { _deathManager.ProcessDeathFromOther(e.Text); } catch (Exception ex) { _logger.Error(ex); } }
//--------------------------------------------------------------------- // Event handler when a cohort is killed by an age-only disturbance. public static void CohortKilledByAgeOnlyDisturbance(object sender, DeathEventArgs eventArgs) { // // If this plug-in is not running, then some base disturbance // // plug-in killed the cohort. if (!running) { return; } // // If this plug-in is running, then the age-only disturbance must // // be a cohort-selector from Base Harvest. /* 2015-07-30 LCB * Yes, this is double-counting. The Biomass is recorded when the SiteHarvested event fires * Disconnecting event in the LoadParameters() method of this class */ int reduction = eventArgs.Cohort.Biomass; // Is this double-counting?? SiteVars.BiomassRemoved[eventArgs.Site] += reduction; //ModelCore.UI.WriteLine("Cohort Biomass removed={0:0.0}; Total Killed={1:0.0}.", reduction, SiteVars.BiomassRemoved[eventArgs.Site]); //Landis.Library.BiomassHarvest.SiteVars.CohortsPartiallyDamaged[eventArgs.Site]++; }
internal static void OnDeath(int npcid, int killerid, int weaponid) { var fcnpc = Find(npcid); var args = new DeathEventArgs(BasePlayer.Find(killerid), (Weapon)weaponid); fcnpc?.Died?.Invoke(fcnpc, args); }
//--------------------------------------------------------------------- public void CohortDied(object sender, DeathEventArgs eventArgs) { PlugInType disturbanceType = eventArgs.DisturbanceType; ActiveSite site = eventArgs.Site; ICohort cohort = eventArgs.Cohort; double foliar = (double) cohort.LeafBiomass; double wood = (double) cohort.WoodBiomass; if (disturbanceType == null) { //UI.WriteLine("NO EVENT: Cohort Died: species={0}, age={1}, disturbance={2}.", cohort.Species.Name, cohort.Age, eventArgs.DisturbanceType); ForestFloor.AddWoodyDebris(wood, cohort.Species, SiteVars.WoodyDebris[site]); ForestFloor.AddDisturbanceLitter(foliar, cohort.Species, site, SiteVars.Litter[site]); double killedFineRoots = Roots.CalculateFineRoot(foliar, SpeciesData.LeafLongevity[cohort.Species]); Roots.KillFineRoots(killedFineRoots, cohort.Species, SiteVars.DeadFineRootsAdd[site]); Roots.ReduceFineRoots(killedFineRoots, cohort.Species, SiteVars.FineRoots[site]); double killedCoarseRoots = Roots.CalculateCoarseRoot(wood, SpeciesData.LeafLongevity[cohort.Species]); ForestFloor.AddWoodyDebris(killedCoarseRoots, cohort.Species, SiteVars.WoodyDebris[site]); Roots.ReduceCoarseRoots(killedCoarseRoots, cohort.Species, SiteVars.CoarseRoots[site]); } if (disturbanceType != null) { //ActiveSite site = eventArgs.Site; Disturbed[site] = true; if (disturbanceType.IsMemberOf("disturbance:fire")) Landis.Succession.Reproduction.CheckForPostFireRegen(eventArgs.Cohort, site); else Landis.Succession.Reproduction.CheckForResprouting(eventArgs.Cohort, site); } }
//--------------------------------------------------------------------- public void CohortDied(object sender, DeathEventArgs eventArgs) { //UI.WriteLine("Cohort Died! :-("); PlugInType disturbanceType = eventArgs.DisturbanceType; ActiveSite site = eventArgs.Site; ICohort cohort = eventArgs.Cohort; double foliar = (double) cohort.LeafBiomass; double wood = (double) cohort.WoodBiomass; //UI.WriteLine("Cohort Died: species={0}, age={1}, biomass={2}, foliage={3}.", cohort.Species.Name, cohort.Age, cohort.Biomass, foliar); if (disturbanceType == null) { //UI.WriteLine("NO EVENT: Cohort Died: species={0}, age={1}, disturbance={2}.", cohort.Species.Name, cohort.Age, eventArgs.DisturbanceType); ForestFloor.AddWoodLitter(wood, cohort.Species, eventArgs.Site); ForestFloor.AddFoliageLitter(foliar, cohort.Species, eventArgs.Site); Roots.AddCoarseRootLitter(wood, cohort.Species, eventArgs.Site); Roots.AddFineRootLitter(foliar, cohort.Species, eventArgs.Site); } if (disturbanceType != null) { //UI.WriteLine("DISTURBANCE EVENT: Cohort Died: species={0}, age={1}, disturbance={2}.", cohort.Species.Name, cohort.Age, eventArgs.DisturbanceType); Disturbed[site] = true; if (disturbanceType.IsMemberOf("disturbance:fire")) Landis.Succession.Reproduction.CheckForPostFireRegen(eventArgs.Cohort, site); else Landis.Succession.Reproduction.CheckForResprouting(eventArgs.Cohort, site); } }
protected override void OnPlayerDied(BasePlayer sender, DeathEventArgs e) { base.OnPlayerDied(sender, e); var player = sender as Player; var killer = e.Killer as Player; player.IsDead = true; player.UpdateData("totalDeaths", ++player.Data.TotalDeaths); ++player.Deaths; ++player.PlayerTeam.Deaths; player.KillingSprees = 0; BasePlayer.SendDeathMessageToAll(killer, player, e.DeathReason); if (player.IsStateUser == StateUser.Force) { player.IsStateUser = StateUser.Kill; } if (player.IsCapturedFlag()) { player.PlayerTeam.TeamRival.Drop(player, killer); } if (killer != null) { ++killer.PlayerTeam.Kills; killer.UpdateData("totalKills", ++killer.Data.TotalKills); ++killer.Kills; ++killer.Adrenaline; ++killer.KillingSprees; killer.ShowKillingSprees(); killer.SetNextRank(); TextDrawPlayer.UpdateTdStats(killer); } TextDrawPlayer.UpdateTdStats(player); }
//--------------------------------------------------------------------- public void AgeOnlyCohortDeath(object sender, DeathEventArgs eventArgs) { Assert.IsTrue(sender is WrappedDisturbance); Assert.AreEqual(expectedDistType, eventArgs.DisturbanceType); Assert.AreEqual(expectedSite, eventArgs.Site); cohortsKilledByAgeOnlyDist.Add(eventArgs.Cohort); }
//--------------------------------------------------------------------- public void CohortDeath(object sender, DeathEventArgs eventArgs) { Assert.AreEqual(expectedSender, sender); Assert.AreEqual(expectedDistType, eventArgs.DisturbanceType); Assert.AreEqual(expectedSite, eventArgs.Site); deadCohorts.Add(eventArgs.Cohort); }
/// <summary> /// Called after a GameOverEvent is invoked. /// </summary> /// <param name="invoker">The event invoker.</param> /// <param name="e">The event arguments/message.</param> private void HandleDeathEvent(object invoker, System.EventArgs e) { DeathEventArgs args = (DeathEventArgs)e; // TODO: Check if all players dead // If so, invoke GameOver Debug.Log("LARSGameSession.HandleDeathEvent: Checking if all players have died."); }
//--------------------------------------------------------------------- public void MySenescenceDeathMethod(object sender, DeathEventArgs eventArgs) { Assert.AreEqual(expectedSender, sender); Assert.AreEqual(null, eventArgs.DisturbanceType); Assert.AreEqual(activeSite, eventArgs.Site); Assert.IsNotNull(eventArgs.Cohort); deadCohorts.Add(eventArgs.Cohort); }
private void CharacterFilter_Death(object sender, DeathEventArgs e) { try { TriggerWebhooksForEvent(EVENTS.DEATH, Core.CharacterFilter.Name + " has died: " + e.Text); } catch (Exception ex) { Util.LogError(ex); } }
abstract public void Massager(); //进入范围内应该播放的语音。 //死亡设定 public virtual void Death(GameObject obj, string sound) { //调用音效 //播放死亡动画 DeathEventArgs death = new DeathEventArgs(); death.grade = this.grade; death.senderObject = obj; death.deathSound = sound; DeathEvent.Invoke(this, death); }
private void Delete(object sender, DeathEventArgs e) { if (sender is Animal) { DeleteAnim(sender as Animal); } else if (sender is Envir) { DeleteEnvir(sender as Envir); } }
private async void Mission_PlayerDied(object sender, DeathEventArgs e) { if (!(sender is Player player)) { return; } await ClassEndMissionAsync(player); player.MissionTextDraw.Text = string.Empty; player.MissionTextDraw.Hide(); }
//--------------------------------------------------------------------- // Event handler when a cohort is killed by an age-only disturbance. public void CohortKilledByAgeOnlyDisturbance(object sender, DeathEventArgs eventArgs) { // If this plug-in is not running, then some base disturbance // plug-in killed the cohort. if (!running) { return; } SiteVars.BiomassRemoved[eventArgs.Site] += eventArgs.Cohort.Biomass; }
//--------------------------------------------------------------------- public void CohortDied(object sender, DeathEventArgs eventArgs) { PlugInType disturbanceType = eventArgs.DisturbanceType; if (disturbanceType != null) { ActiveSite site = eventArgs.Site; Disturbed[site] = true; if (disturbanceType.IsMemberOf("disturbance:fire")) Landis.Succession.Reproduction.CheckForPostFireRegen(eventArgs.Cohort, site); else Landis.Succession.Reproduction.CheckForResprouting(eventArgs.Cohort, site); } }
public static void CohortDied(object sender, DeathEventArgs eventArgs) { PlugInType disturbanceType = eventArgs.DisturbanceType; PoolPercentages cohortReductions = Module.Parameters.CohortReductions[disturbanceType]; ICohort cohort = eventArgs.Cohort; ActiveSite site = eventArgs.Site; double nonWoody = (double) cohort.LeafBiomass; double woody = (double)cohort.WoodBiomass; double nonWoodyInput = ReduceInput(nonWoody, cohortReductions.NonWoody); double woodyInput = ReduceInput(woody, cohortReductions.Woody); ForestFloor.AddWoodyDebris(woodyInput, cohort.Species, SiteVars.WoodyDebris[site]); //Assuming that all disturbance happen during leaf on periods: ForestFloor.AddDisturbanceLitter(nonWoodyInput, cohort.Species, site, SiteVars.LitterAdd[site]); double killedFineRoots = Roots.CalculateFineRoot(nonWoody, SpeciesData.LeafLongevity[cohort.Species]); Roots.KillFineRoots(killedFineRoots, cohort.Species, SiteVars.DeadFineRootsAdd[site]); Roots.ReduceFineRoots(killedFineRoots, cohort.Species, SiteVars.FineRoots[site]); double killedCoarseRoots = Roots.CalculateCoarseRoot(woody, SpeciesData.LeafLongevity[cohort.Species]); ForestFloor.AddWoodyDebris(killedCoarseRoots, cohort.Species, SiteVars.WoodyDebris[site]); Roots.ReduceCoarseRoots(killedCoarseRoots, cohort.Species, SiteVars.CoarseRoots[site]); //If the disturbance is due to fire, add portion of consumed biomass to // charcoal (Preston and Schmidt 2006) and mineral soil pools // (Raison et al. 1985). if (disturbanceType.Name == "disturbance:fire") { SiteVars.Charcoal[site].ContentC += (((nonWoody - nonWoodyInput) * SpeciesData.LeafFractionC[cohort.Species] + (woody - woodyInput) * SpeciesData.WoodFractionC[cohort.Species]) * 0.08); SiteVars.Charcoal[site].ContentN += (((nonWoody - nonWoodyInput) * SpeciesData.LeafFractionN[cohort.Species] + (woody - woodyInput) * SpeciesData.WoodFractionN[cohort.Species]) * 0.08); SiteVars.Charcoal[site].ContentP += (((nonWoody - nonWoodyInput) * SpeciesData.LeafFractionP[cohort.Species] + (woody - woodyInput) * SpeciesData.WoodFractionP[cohort.Species]) * 0.08); SiteVars.MineralSoil[site].ContentN += (((nonWoody - nonWoodyInput) * SpeciesData.LeafFractionN[cohort.Species] + (woody - woodyInput) * SpeciesData.WoodFractionN[cohort.Species]) * 0.01); SiteVars.MineralSoil[site].ContentP += (((nonWoody - nonWoodyInput) * SpeciesData.LeafFractionP[cohort.Species] + (woody - woodyInput) * SpeciesData.WoodFractionP[cohort.Species]) * 0.42); } }
//--------------------------------------------------------------------- /// <summary> /// Event handler for when a cohort dies because of cutting (i.e., it's /// completely harvested). /// </summary> public static void CohortDied(object sender, DeathEventArgs eventArgs) { ICohort cohort = eventArgs.Cohort; if (isDebugEnabled) { log.DebugFormat(" cohort died: {0}, age {1}, biomass {2}", cohort.Species.Name, cohort.Age, cohort.Biomass); } RecordHarvest(cohort.Species, cohort.Biomass); }
// Use this for initialization public void test() { FFA_GameManager gm = this.GetComponent<FFA_GameManager>(); gm.addEntry("Player 1"); gm.addEntry("Player 2"); DeathEventArgs args = new DeathEventArgs(Test1, Test2); EventManager.instance.invokeEvent("onPlayerDeath", args); args = new DeathEventArgs(Test2, Test1); EventManager.instance.invokeEvent("onPlayerDeath", args); Debug.Log(gm.getKDRTableAsString()); }
//--------------------------------------------------------------------- // Event handler when a cohort is killed by an age-only disturbance. public static void CohortKilledByAgeOnlyDisturbance(object sender, DeathEventArgs eventArgs) { // // If this plug-in is not running, then some base disturbance // // plug-in killed the cohort. if (!running) { return; } // // If this plug-in is running, then the age-only disturbance must // // be a cohort-selector from Base Harvest. //ModelCore.UI.WriteLine("Cohort Biomass removed={0:0.0}; Total Killed={1:0.0}.", reduction, SiteVars.BiomassRemoved[eventArgs.Site]); //Landis.Library.BiomassHarvest.SiteVars.CohortsPartiallyDamaged[eventArgs.Site]++; }
//死亡处理 public void Death(System.Object sender, DeathEventArgs e) { MainManager._instance._poolManager.Destroy(e.senderObject, Type.NPC); switch (sender.GetType().Name) { case "Enemy": //进行奖励调用 Award(e.grade, e.senderObject.transform); break; case "Player": //调用死亡之后的UI break; } }
public static void CohortDied(object sender, DeathEventArgs eventArgs) { ExtensionType disturbanceType = eventArgs.DisturbanceType; PoolPercentages cohortReductions = Module.Parameters.CohortReductions[disturbanceType]; ICohort cohort = (Landis.Library.BiomassCohorts.ICohort)eventArgs.Cohort; ActiveSite site = eventArgs.Site; int nonWoody = cohort.ComputeNonWoodyBiomass(site); int woody = (cohort.Biomass - nonWoody); int nonWoodyInput = ReduceInput(nonWoody, cohortReductions.Foliar); int woodyInput = ReduceInput(woody, cohortReductions.Wood); //ForestFloor.AddBiomass(woodyInput, nonWoodyInput, cohort.Species, site); ForestFloor.AddWoody(woodyInput, cohort.Species, site); ForestFloor.AddLitter(nonWoodyInput, cohort.Species, site); }
public static void CohortDied(object sender, DeathEventArgs eventArgs) { PlugInType disturbanceType = eventArgs.DisturbanceType; PoolPercentages cohortReductions = Module.Parameters.CohortReductions[disturbanceType]; ICohort cohort = eventArgs.Cohort; ActiveSite site = eventArgs.Site; int nonWoody = cohort.ComputeNonWoodyBiomass(site); int woody = (cohort.Biomass - nonWoody); int nonWoodyInput = ReduceInput(nonWoody, cohortReductions.Foliar); int woodyInput = ReduceInput(woody, cohortReductions.Wood); //ForestFloor.AddBiomass(woodyInput, nonWoodyInput, cohort.Species, site); ForestFloor.AddWoody(woodyInput, cohort.Species, site); ForestFloor.AddLitter(nonWoodyInput, cohort.Species, site); }
public static void CohortDied(object sender, DeathEventArgs eventArgs) { PlugInType disturbanceType = eventArgs.DisturbanceType; PoolPercentages cohortReductions = Module.Parameters.CohortReductions[disturbanceType]; ICohort cohort = eventArgs.Cohort; ActiveSite site = eventArgs.Site; ushort nonWoody = cohort.ComputeNonWoodyBiomass(site); ushort woody = (ushort) (cohort.Biomass - nonWoody); ushort nonWoodyInput = ReduceInput(nonWoody, cohortReductions.NonWoody); ushort woodyInput = ReduceInput(woody, cohortReductions.NonWoody); Dead.Pools.AddBiomass(woodyInput, nonWoodyInput, cohort.Species, site); }
public static void CohortDied(object sender, DeathEventArgs eventArgs) { ExtensionType disturbanceType = eventArgs.DisturbanceType; //PoolPercentages cohortReductions = Module.Parameters.CohortReductions[disturbanceType]; ICohort cohort = eventArgs.Cohort; ActiveSite site = eventArgs.Site; if (disturbanceType.IsMemberOf("disturbance:harvest")) //base harvest doesn't get here ever, but biomass harvest does. { return; //It has already been accounted for, however in PlugIn.CohortDied, so don't repeat here. } double foliar = (double)cohort.ComputeNonWoodyBiomass(site); double wood = ((double)cohort.Biomass - foliar); SiteVars.soilClass[site].DisturbanceImpactsBiomass(site, cohort.Species, cohort.Age, wood, foliar, disturbanceType.Name, 0); }
public void CohortDied(object sender, DeathEventArgs eventArgs) { ExtensionType disturbanceType = eventArgs.DisturbanceType; if (disturbanceType != null) { ActiveSite site = eventArgs.Site; Disturbed[site] = true; if (disturbanceType.IsMemberOf("disturbance:fire")) { Reproduction.CheckForPostFireRegen(eventArgs.Cohort, site); } else { Reproduction.CheckForResprouting(eventArgs.Cohort, site); } } }
//--------------------------------------------------------------------- public void MyCohortDiedMethod(object sender, DeathEventArgs eventArgs) { Assert.AreEqual(MockSpeciesCohortsDisturbance.Type, eventArgs.DisturbanceType); Assert.AreEqual(activeSite, eventArgs.Site); Assert.IsNotNull(eventArgs.Cohort); ICohort cohort = eventArgs.Cohort; ISpeciesCohorts speciesCohorts = sender as ISpeciesCohorts; Assert.IsNotNull(speciesCohorts); Assert.AreEqual(cohort.Species, speciesCohorts.Species); List<ushort> ages; if (! deadCohorts.TryGetValue(cohort.Species, out ages)) { ages = new List<ushort>(); deadCohorts[cohort.Species] = ages; } ages.Add(cohort.Age); }
//--------------------------------------------------------------------- public void CohortDied(object sender, DeathEventArgs eventArgs) { ExtensionType disturbanceType = eventArgs.DisturbanceType; if (disturbanceType != null) { ActiveSite site = eventArgs.Site; Disturbed[site] = true; if (disturbanceType.IsMemberOf("disturbance:fire")) { Landis.Library.Succession.Reproduction.CheckForPostFireRegen(eventArgs.Cohort, site); } else { Landis.Library.Succession.Reproduction.CheckForResprouting(eventArgs.Cohort, site); } } //modelCore.Log.WriteLine(" Cohort DIED: {0}:{1}.", eventArgs.Cohort.Species.Name, eventArgs.Cohort.Age); }
//--------------------------------------------------------------------- public void MyCohortDiedMethod(object sender, DeathEventArgs eventArgs) { Assert.AreEqual(MockSpeciesCohortsDisturbance.Type, eventArgs.DisturbanceType); Assert.AreEqual(activeSite, eventArgs.Site); Assert.IsNotNull(eventArgs.Cohort); ICohort cohort = eventArgs.Cohort; ISpeciesCohorts speciesCohorts = sender as ISpeciesCohorts; Assert.IsNotNull(speciesCohorts); Assert.AreEqual(cohort.Species, speciesCohorts.Species); List <ushort> ages; if (!deadCohorts.TryGetValue(cohort.Species, out ages)) { ages = new List <ushort>(); deadCohorts[cohort.Species] = ages; } ages.Add(cohort.Age); }
public static void CohortDied(object sender, DeathEventArgs eventArgs) { ThrowException(); }
private async void Convoy_PlayerDied(object sender, DeathEventArgs e) { var player = sender as Player; await MissionConvoy.PlayerLeaveConvoyAsync(player); }
protected void UnderlyingAnt_Died(object sender, DeathEventArgs e) { All.Remove(this); if (this.Type == AntType.Queen) { Queen.Ant = null; } }
//--------------------------------------------------------------------- public void DeathNotExpected(object sender, DeathEventArgs eventArgs) { Assert.Fail("A cohort died unexpectedly"); }
private void SelfDied(object sender, DeathEventArgs e) { ClearTargets(); }
private void CharacterFilter_Death(object sender, DeathEventArgs e) { }
private void CharacterFilter_Death(object sender, DeathEventArgs e) { try { if (chkAutoUpdateRecalls.Checked) { mRecallingToLSBind = RecallStep.RecallStarted; if (mRecallTimeout.Enabled) RecallTimeout_Tick(null, null); mRecallTimeout.Interval = 30000; // 30 seconds mRecallTimeout.Start(); } if (chkTrackCorpses.Checked) { string name = "Corpse of " + Core.CharacterFilter.Name + " [" + DateTime.Now.ToShortTimeString() + "]"; string descr = "Corpse of " + Core.CharacterFilter.Name + "\n" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "\n" + e.Text; string dungeonName = mDungeonHud.GetDungeonNameByLandblock(Host.Actions.Landcell); if (dungeonName != "") { name += " in " + dungeonName; descr += "\nIn Dungeon: " + dungeonName; } Location corpse = new Location(Location.GetNextInternalId(), name, LocationType.Custom, PlayerCoords, descr); corpse.Icon = AcIcons.Corpse; mArrowHud.DestinationLocation = corpse; } } catch (Exception ex) { Util.HandleException(ex); } }
void CharacterFilter_Death(object sender, DeathEventArgs e) { // DO STUFF HERE }
//--------------------------------------------------------------------- public static void CohortDied(object sender, DeathEventArgs eventArgs) { ExtensionType disturbanceType = eventArgs.DisturbanceType; }
private void playerKilled(Object sender, DeathEventArgs args) { //Do things like announce death/method of death detectWinner(); }