/// <summary> /// Clears the tile, sets all the variables for tile contents to null, sets isBlocked to false. /// </summary> public void clearTile() { creature = null; plant = null; remains = null; obstacle = null; isBlocked = false; }
/// <summary> /// Handles the code for killing a specified creature /// </summary> /// <param name="c">The creature to kill</param> public void killCreature(Creature c) { int[] loc = c.getLocationXY(); creatureList.Remove(c); getTile(loc[1], loc[0]).clearTile(); c.setLocation(-1, -1); Remains r = new Remains(randomNumberGenerator); r.setLocation(loc[0], loc[1]); remainsList.Add(r); getTile(loc[1], loc[0]).addRemains(r); deadList.Push(c); #if DEBUG Console.WriteLine("Remains added at: " + loc[0] + "," + loc[1]); #endif }
/// <summary> /// Adds remains to the tile, sets the remains variable to the specified remains and sets the tile to be blocked /// </summary> /// <param name="c">The remains to add to the tile</param> public void addRemains(Remains r) { remains = r; isBlocked = true; }
/// <summary> /// Views remains, sets viewing to be true and sets up the information viewing commands /// </summary> /// <param name="c">The Remains to be viewed</param> private void viewRemains(Remains r) { viewing = true; maxInfo = remainsMaxInfo; remainsView = r; }
/// <summary> /// Cancels views, sets viewing to be false and all the viewing variables etc. to be null /// </summary> private void deView() { viewing = false; creatureView = null; plantView = null; remainsView = null; following = false; dataViewed = 0; buttons[3].setVisible(false); buttons[4].setVisible(false); buttons[5].setVisible(false); }
/// <summary> /// Gets an array of strings that contain information about some remains /// </summary> /// <param name="c">The remains to get information about</param> /// <returns>An array of strings containing a set of information about some remains</returns> public string[] getRemainsInfo(Remains r) { string[] status = new string[1]; switch (DataViewed) { case 0: status = new string[] { "Food Units Remaining: " + r.getFoodRemaining(), "Food value: " + r.getFoodValue(), "Decays in: " + r.getTicksRemainingBeforeAction() + " ticks" }; break; } return status; }
/// <summary> /// Draws the remains viewing window /// </summary> /// <param name="c">The remains object to draw the viewing window for</param> private void drawRemainsView(Remains r) { drawBack(); Simulation.getGraphicsDeviceManager().GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap; spriteBatch.Begin(0, null, SamplerState.PointWrap, null, null); Rectangle rect = new Rectangle((Display.getWindowWidth() - 800) / 2 + 10, Display.getWindowHeight() - 130, 120, 120); Texture2D tex = remainsTile; spriteBatch.Draw(tex, rect, Color.White); spriteBatch.End(); string[] status = inputHandler.getRemainsInfo(r); Vector2 topLeft = new Vector2((Display.getWindowWidth() - 800) / 2 + 10 + 120 + 10, Display.getWindowHeight() - 130); string title = "Remains"; drawStrings(topLeft, title, status, 4); }