예제 #1
0
파일: Creature.cs 프로젝트: OCox1991/Genome
 /// <summary>
 /// A method used to check if you can detect a creature that is trying to be stealthy
 /// </summary>
 /// <param name="c">The creature in the scan radius that we are checking we can see</param>
 /// <returns>True if the creature is not hidden, false if the creature is hidden</returns>
 private bool canSee(Creature c)
 {
     bool b = true;
     double i = getEuclideanDistanceFrom(c);
     if (i > awareness)
     {
         b = false;
     }
     else if(random.Next(100) < c.getStealthVal() + (i - awareness))
     {
         b = false;
     }
     return b;
 }
예제 #2
0
 /// <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;
 }