Example #1
0
 public override void Interact(MapTile tile)
 {
     bool grassFound = false;
     bool hasFeature = false;
     if (tile.mySprites.Count > 0)
     {
         foreach (Sprite s in tile.mySprites)
         {
             if (s != null)
             {
                 if (s.name.Equals("GrassSprite"))
                 {
                     grassFound = true;
                 }
                 if (s.name.Equals("House") || s.name.Equals("Tree"))
                 {
                     hasFeature = true;
                 }
             }
         }
     }
     if (grassFound && hasFeature == false)
     {
         tile.Add(game.motherHouse.Clone());
     }
 }
Example #2
0
 public override void Interact(MapTile tile)
 {
     bool isBurnable = false;
     Sprite spriteToBurn = null;
     if (tile.mySprites.Count > 0)
     {
         foreach (Sprite s in tile.mySprites)
         {
             if (s != null)
             {
                 if (s.name.Equals("House") || s.name.Equals("Tree"))
                 {
                     isBurnable = true;
                     spriteToBurn = s;
                     break;
                 }
             }
         }
     }
     if (isBurnable)
     {
         MethodInfo myMethod = spriteToBurn.GetType().GetMethod("burn");
         myMethod.Invoke(spriteToBurn, null);
         if (tile.mySprites.ElementAt(0).name.Equals("GrassSprite"))
         {
             tile.mySprites.RemoveAt(0);
         }
     }
 }
Example #3
0
 public override void Interact(MapTile tile)
 {
     bool isElectrocutable = false;
     Sprite spriteToElectro = null;
     if (tile.mySprites.Count > 0)
     {
         foreach (Sprite s in tile.mySprites)
         {
             if (s != null)
             {
                 if ((s.name.Equals("House")) || (s.name.Equals("People")) || (s.name.Equals("Tree")))
                 {
                     isElectrocutable = true;
                     spriteToElectro = s;
                     break;
                 }
             }
         }
     }
     if (isElectrocutable)
     {
         MethodInfo myMethod = spriteToElectro.GetType().GetMethod("electrocute");
         myMethod.Invoke(spriteToElectro, null);
     }
 }
Example #4
0
 public override void Interact(MapTile tile)
 {
     //bool grassFound = false;
     bool hasProtect = false;
     bool hasFeature = false;
     if (tile.mySprites.Count > 0)
     {
         foreach (Sprite s in tile.mySprites)
         {
             if (s != null)
             {
                 if (s.name.Equals("GrassSprite"))
                 {
                     //grassFound = true;
                 }
                 if (s.name.Equals("House") || s.name.Equals("Tree"))
                 {
                     hasFeature = true;
                 }
                 if (s.name.Equals("Halo"))
                 {
                     hasProtect = true;
                     Halo h = (Halo)s;
                     h.Protect();
                 }
             }
         }
     }
     if (hasFeature && hasProtect == false)
     {
         tile.Add(game.motherHalo.Clone());
     }
 }
Example #5
0
 public override void Interact(MapTile tile)
 {
     //bool grassFound = false;
     //if (tile.mySprites.Count > 0)
     //{
     //    foreach (Sprite s in tile.mySprites)
      //   {
      //       if (s != null)
       //      {
       //          if (s.name.Equals("GrassSprite"))
       //          {
       //              grassFound = true;
       //              break;
       //          }
       //      }
        // }
     //}
     //if (grassFound)
         //tile.Clear();
         person = game.person.Clone();
         tile.Add(person);
 }
Example #6
0
 public override void Interact(MapTile tile)
 {
     bool grassFound = false;
     if (tile.mySprites.Count > 0)
     {
         foreach (Sprite s in tile.mySprites)
         {
             if (s != null)
             {
                 if (s.name.Equals("GrassSprite"))
                 {
                     grassFound = true;
                     break;
                 }
             }
         }
     }
     if (grassFound)
     {
         tile.Clear();
         tile.Add(game.motherHouse.Clone());
     }
 }
Example #7
0
 public virtual void Interact(MapTile tile)
 {
 }
Example #8
0
 public virtual void Interact(MapTile tile, MouseState mState)
 {
 }
Example #9
0
File: Map.cs Project: xcmel/FWPGame
 /// <summary>
 /// Create the tile grid given the size of the map.
 /// </summary>
 /// <param name="textureSize"></param>
 public void CreateTileGrid(Vector2 textureSize)
 {
     int tilesX = (int) textureSize.X / MAX_TILE_SIZE;
     int tilesY = (int) textureSize.Y / MAX_TILE_SIZE;
     mapTiles = new MapTile[tilesX, tilesY];
     for (int i = 0; i < tilesX; i++)
     {
         for (int j = 0; j < tilesY; j++)
         {
             MapTile tile = new MapTile(new Vector2(i * MAX_TILE_SIZE, j * MAX_TILE_SIZE),
                 new Vector2(MAX_TILE_SIZE, MAX_TILE_SIZE));
             mapTiles[i, j] = tile;
         }
     }
 }
Example #10
0
 public override void Interact(MapTile tile)
 {
     tile.Add(game.myGrass.Clone());
 }
Example #11
0
 public override void Interact(MapTile tile, MouseState mState)
 {
     //intentionall empty
 }