private void SimulationPredatorFoundPrey(Predator predator, Prey prey) { predator.Prey = prey; prey.UpdatePredator(predator); if (prey.CharacterClass == predator.CharacterClass) { prey.WeakAgainstPredator(); } Instance.PictureBox_State.Image = IStateImages["Target"]; Instance.Label_StateMessage.Text = "¡" + prey.Name + " se encuentra bajo la mira de " + predator.Name + "!"; Instance.Label_StateMessage.Location = new Point(IPanelMiddle.X - Instance.Label_StateMessage.Width / 2, Instance.Label_StateMessage.Location.Y); Instance.Refresh(); if (ILastStatus != "PreyFound") { Pause(2000); } RepaintScenario(); ILastStatus = "PreyFound"; }
private string GetPreySlayedMessage(Predator predator) { if (!IFirstBloodOcurred) { return("¡" + predator.Name + " se apunto la primera sangre!"); } else if (predator.HuntedPreys > 0) { return(predator.Name + " esta en racha ¡Esta imparable!"); } else { return("¡Anotenle uno a la cuenta de " + predator.Name + "!"); } }
private void SimulationPreySlayedStatus(Predator predator, Prey prey) { Instance.PictureBox_State.Image = IStateImages["Death"]; Instance.Label_StateMessage.Text = GetPreySlayedMessage(predator); Instance.Label_StateMessage.Location = new Point(IPanelMiddle.X - Instance.Label_StateMessage.Width / 2, Instance.Label_StateMessage.Location.Y); Instance.Label_TotalPredators.Text = "Total de depredadores: " + Instance.Predators.Count; Instance.Label_TotalPreys.Text = "Total de presas: " + Instance.Preys.Count; if (GetBestPredator() != null) { Instance.Label_BestPredator.Text = "Mejor Cazador: " + GetBestPredator().Name; } if (!IFirstBloodOcurred) { Instance.Label_FirstBlood.Text = "Primera sangre: " + predator.Name; IFirstBloodOcurred = true; } Graphics.FromImage(ITemporalFrame).FillEllipse(new SolidBrush(predator.Color), prey.Location.X - 50, prey.Location.Y - 50, 100, 100); Instance.PictureBox_Graph.Image = ITemporalFrame; Instance.Refresh(); Pause(2000); Instance.Refresh(); RepaintScenario(); for (int i = 0; i < Instance.Preys.Count; ++i) { if (Instance.Preys[i].Name == prey.Name) { Instance.Preys.RemoveAt(i); break; } } predator.Prey = null; predator.Hunting = false; ++predator.HuntedPreys; predator.GiveKillPerk(); }
public void UpdatePredator(Predator predator = null) { if (predator == null) { this.IPredator = null; this.IUnderPredation = false; this.IPicture = IPictureBackUp; } else { this.IPredator = predator; this.IUnderPredation = true; Bitmap bmp = new Bitmap(150, 150); Graphics.FromImage(bmp).FillEllipse(new SolidBrush(predator.Color), 0, 0, 150, 150); Graphics.FromImage(bmp).DrawImage(IPicture, 25, 25); this.IPicture = bmp; } }