Advertisement
Guest User

TreeRegion

a guest
Mar 28th, 2012
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.95 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Microsoft.Xna.Framework.Graphics;
  6. using Microsoft.Xna.Framework;
  7.  
  8. namespace Stake_it_Out
  9. {
  10.     public class TreeRegion
  11.     {
  12.         Viewport viewport;
  13.         Vector2 startingGridPosition;
  14.         Game1 gameObject;
  15.  
  16.         int numberTreesX, regionX, regionY;
  17.         float x,y;
  18.  
  19.         List<Vector2> treedList;
  20.  
  21.         //Constructor
  22.         public TreeRegion(Vector2 myStartingPosition,int myX, int myY, Viewport viewport)
  23.         {
  24.             gameObject = new Game1();
  25.  
  26.             treedList = new List<Vector2>();
  27.  
  28.             regionX = myX;
  29.             regionY = myY;
  30.             numberTreesX = (regionX / 2);
  31.  
  32.             startingGridPosition = myStartingPosition;
  33.             x = startingGridPosition.X;
  34.             y = startingGridPosition.Y;
  35.  
  36.             Vector2 tree = new Vector2(x, y);
  37.             treedList.Add(tree);
  38.             x += 60;
  39.            
  40.            
  41.             this.viewport = viewport;
  42.         }
  43.  
  44.  
  45.         //Create them
  46.         public void createTreess()
  47.         {
  48.             for (int b=0; b <= regionY; b++)
  49.             {
  50.                 for (int a = 0; a <= numberTreesX; a++)
  51.                 {
  52.                     Vector2 tree = new Vector2(x,y);
  53.                     treedList.Add(tree);
  54.                     x=+60;
  55.                 }
  56.                 x-=(30*(numberTreesX*2));
  57.                 y += 60;
  58.             }
  59.         }
  60.  
  61.        
  62.         //Skew the bitches
  63.         public void skewTrees()
  64.         {
  65.  
  66.         }
  67.  
  68.  
  69.         //Communicate with Tiles
  70.         public void sendResults()
  71.         {
  72.             for (int a = 0; a < treedList.Count; a++)
  73.             {
  74.                 int xInt = (int)treedList[a].X;
  75.                 int yInt = (int)treedList[a].Y;
  76.                 gameObject.tileArray[xInt, yInt].treed = true;
  77.             }
  78.            
  79.            
  80.         }
  81.     }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement