/// <summary> /// This method is called if an ant dies. It informs you that /// the ant has died. The ant cannot undertake any more /// actions from that point forward. /// Read more: "http://wiki.antme.net/en/API1:HasDied" /// </summary> /// <param name="kindOfDeath">Kind of Death</param> public override void HasDied(KindOfDeath kindOfDeath) { // As there are no more actions possible, // it don't make any sense to use this event // with non-static ants. // However as an !static! ant it could be used to react // on certain circumstances and adjust the spawn castes. }
/// <summary> /// Will be fired when the ant is going to death /// </summary> /// <param name="kindOfDeath">Kind of Death</param> public virtual void HasDied(KindOfDeath kindOfDeath) { }
public override void HasDied(KindOfDeath kindOfDeath) { Died(this, new DeathEventArgs(kindOfDeath)); }
public DeathEventArgs(KindOfDeath KindOfDeath) { this.KindOfDeath = KindOfDeath; }
public override void HasDied(KindOfDeath kindOfDeath) { this.Think($"Ouch, I'm dead: {kindOfDeath}."); }
/// <summary> /// This method is called if an ant dies. It informs you that the ant has /// died. The ant cannot undertake any more actions from that point forward. /// Read more: "http://wiki.antme.net/en/API1:HasDied" /// </summary> /// <param name="kindOfDeath">Kind of Death</param> public override void HasDied(KindOfDeath kindOfDeath) { // Call behavior behavior.HasDied(kindOfDeath); }
/// <summary> /// Is called once if the ant dies. /// </summary> /// <param name="kindofdeath">Why the ant died</param> public override void HasDied(KindOfDeath kindofdeath) { }
/// <summary> /// This method is called if an ant dies. It informs you that the ant has /// died. The ant cannot undertake any more actions from that point forward. /// Read more: "http://wiki.antme.net/en/API1:HasDied" /// </summary> /// <param name="kindOfDeath">Kind of Death</param> public override void HasDied(KindOfDeath kindOfDeath) { if (Caste == "fighter" || Caste == "fighter3") { for (int i = 0; i < 300; i++) { for (int u = 2; u < 300; u++) { if (verfugbar[i, u] == Ameisenliste.IndexOf(this)) { verfugbar[i, u] = 0; verfugbar[i, 1]--; } } } } else if (Caste == "default") { for (int i = 0; i < 10; i++) { for (int u = 2; u < 10; u++) { if (apfelliste[i, u] == Ameisenliste.IndexOf(this)) { apfelliste[i, u] = 0; apfelliste[i, 1]--; } } } } else if (Caste == "sugar") { for (int i = 0; i < 4; i++) { for (int u = 2; u < 100; u++) { if (verfugbar[i, u] == Ameisenliste.IndexOf(this)) { unterwegs[i, u] = 0; unterwegs[i, 1]--; } } } } if (Caste == "searcher") { searcher.Remove(this); } else if (Caste == "star") { for (int i = 1; i < 20; i++) { if (stars[i] == Ameisenliste.IndexOf(this)) { stars[i] = 0; stars[0]--; } } } Ameisenliste.Remove(this); }
/// <summary> /// This method is called if an ant dies. It informs you that the ant has /// died. The ant cannot undertake any more actions from that point forward. /// Read more: "http://wiki.antme.net/en/API1:HasDied" /// </summary> /// <param name="kindOfDeath">Kind of Death</param> public override void HasDied(KindOfDeath kindOfDeath) { TaskManager.Instance.UnregisterWorker(this, task); }