/// <summary> /// A method to sort the creatures by their speed /// </summary> /// <returns></returns> public static int sortCreaturesBySpeed(Creature c1, Creature c2) { int val = 0; if (c1 == null && c2 == null) { val = 0; } else if (c1 == null) { val = 1; } else if (c2 == null) { val = -1; } else { if (c1.getSpeed() < c2.getSpeed()) { val = 1; } else if (c1.getSpeed() > c2.getSpeed()) { val = -1; } else { val = 0; } } return val; }
/// <summary> /// Gets an array of strings that contain information about the creature /// </summary> /// <param name="c">The creature to get information about</param> /// <returns>An array of strings containing a set of information about the creature</returns> public string[] getCreatureInfo(Creature c) { string[] status = new string[1]; switch (DataViewed) { case 0: status = new string[] { "Health: " + c.getHealth(), "Energy :" + c.getEnergy(), "Current Scenario: " + c.CurrentScenario, "Response: " + c.CurrentResponse, "Stamina: " + c.getStamina() + "/" + c.getMaxStamina(), "Location: (" + c.getLocationXY()[0] + "," + c.getLocationXY()[1] + ")" }; break; case 1: int[] colours = c.getDna().getColourCount(); status = new string[] { "Number of...", "0s: " + colours[0], "1s: " + colours[1], "2s: " + colours[2], "3s: " + colours[3], "4s: " + colours[4], "5s: " + colours[5], "6s: " + colours[6] }; break; case 2: Color[] cols = Simulation.getColours(); status = new string[cols.Length]; for (int i = 0; i < cols.Length; i++ ) { status[i] = i + ": " + cols[i].ToString(); } break; case 3: string dietString = "Diet: " + c.getDiet(); if (c.getDiet() < 0.5) { dietString += " (HERBIVORE)"; } else { dietString += " (CARNIVORE)"; } status = new string[] { "Stats:", "STR: " + c.getStrength(), "SPD: " + c.getSpeed(), "STL: " + c.getStealthVal(), "AWA: " + c.getAwareness(), "DEF: " + c.getDefence(), dietString }; break; } return status; }