コード例 #1
0
ファイル: Display.cs プロジェクト: OCox1991/Genome
 /// <summary>
 /// A method that takes a creature and returns a 10 x 10 texture representation of the creature's genome
 /// </summary>
 /// <param name="creature"></param>
 /// <returns></returns>
 public static Texture2D drawGenome(Creature creature)
 {
     return drawGenome(creature.getDna());
 }
コード例 #2
0
ファイル: WorldInputHandler.cs プロジェクト: OCox1991/Genome
 /// <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;
 }
コード例 #3
0
ファイル: WorldDrawer.cs プロジェクト: OCox1991/Genome
 /// <summary>
 /// Draws the creature viewing window
 /// </summary>
 /// <param name="c">The creature to draw the viewing window for</param>
 private void drawCreatureView(Creature c)
 {
     drawBack();
     Simulation.getGraphicsDeviceManager().GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;
     spriteBatch.Begin(0, null, SamplerState.PointWrap, null, null);
     Texture2D tex = c.getDna().getTexture();
     Rectangle r = new Rectangle((Display.getWindowWidth() - 800) / 2 + 10, Display.getWindowHeight() - 130, 120, 120);
     spriteBatch.Draw(tex, r, Color.White);
     String title = "Creature";
     if (c.isStealthy())
     {
         title += " (hiding)";
     }
     string[] status = inputHandler.getCreatureInfo(c);
     Vector2 topLeft = new Vector2((Display.getWindowWidth() - 800) / 2 + 10 + 120 + 10, Display.getWindowHeight() - 130);
     spriteBatch.End();
     drawStrings(topLeft, title, status, 4);
 }