示例#1
0
文件: TileMap.cs 项目: JoeSnow0/ZCOM
 public void ChangeColorGrid(int movement, int actions)
 {
     for (int x = (playerGridColorChange.tileX - (movement * actions)); x <= (playerGridColorChange.tileX + (movement * actions)); x++)
     {
         for (int y = (playerGridColorChange.tileY - (movement * actions)); y <= (playerGridColorChange.tileY + (movement * actions)); y++)
         {
             if (y < 0)
             {
                 continue;
             }
             if (y > mapSizeY - 1)
             {
                 continue;
             }
             if (x < 0)
             {
                 continue;
             }
             if (x > mapSizeX - 1)
             {
                 continue;
             }
             if (currentGrid[x, y] == 99)
             {
                 continue;
             }
             if (tiles[x, y] == 1)
             {
                 continue;
             }
             ClickebleTile tile = tileobjects[x, y];
             if (currentGrid[x, y] < movement && actions != 1)
             {
                 tile.GetComponentInChildren <Renderer>().material = gridMaterials.walkMaterial;        // walk color
             }
             else if (currentGrid[x, y] >= movement || (currentGrid[x, y] <= movement && actions == 1)) //dash if more then movment or if unit only have one action
             {
                 tile.GetComponentInChildren <Renderer>().material = gridMaterials.dashMaterial;        //dash color
             }
         }
     }
 }