コード例 #1
0
ファイル: BuildHouse.cs プロジェクト: xcmel/FWPGame
 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());
     }
 }
コード例 #2
0
ファイル: Fire.cs プロジェクト: xcmel/FWPGame
 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);
         }
     }
 }
コード例 #3
0
ファイル: Electric.cs プロジェクト: xcmel/FWPGame
 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);
     }
 }
コード例 #4
0
ファイル: Protect.cs プロジェクト: xcmel/FWPGame
 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());
     }
 }
コード例 #5
0
ファイル: MakePerson.cs プロジェクト: xcmel/FWPGame
 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);
 }
コード例 #6
0
ファイル: BuildHouse.cs プロジェクト: xcmel/FWPGame
 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());
     }
 }
コード例 #7
0
ファイル: Power.cs プロジェクト: xcmel/FWPGame
 public virtual void Interact(MapTile tile)
 {
 }
コード例 #8
0
ファイル: Power.cs プロジェクト: xcmel/FWPGame
 public virtual void Interact(MapTile tile, MouseState mState)
 {
 }
コード例 #9
0
ファイル: Map.cs プロジェクト: 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;
         }
     }
 }
コード例 #10
0
ファイル: GrowGrass.cs プロジェクト: xcmel/FWPGame
 public override void Interact(MapTile tile)
 {
     tile.Add(game.myGrass.Clone());
 }
コード例 #11
0
ファイル: GrowGrass.cs プロジェクト: xcmel/FWPGame
 public override void Interact(MapTile tile, MouseState mState)
 {
     //intentionall empty
 }