コード例 #1
0
ファイル: Extractor.cs プロジェクト: PeakPei/TheWall_Unity2D
    void SetStorageAndExtract()
    {
        int mX = Mathf.RoundToInt(mouseEnd.x);
        int mY = Mathf.RoundToInt(mouseEnd.y);

        if (mX > 2 && mX < resourceGrid.mapSizeX - 2 && mY > 2 && mY < resourceGrid.mapSizeY - 2)
        {
            if (resourceGrid.GetTileType(mX, mY) == TileData.Types.storage)
            {
                Debug.Log("Storage found for ore!");
                selecting = false;

                buildingUI.currentlyBuilding = false;
                //			lineR.enabled = false;
                // set my storage
                myStorage = resourceGrid.GetTileGameObj(mX, mY).GetComponent <Storage> ();

                // start extracting by finding which direction our rock is
                if (SearchForRock())
                {
                    CycleRocksArray();
                }
            }
            else
            {
                Debug.Log("Need a place to store the ore!");
            }
        }
    }
コード例 #2
0
 bool CheckIfFoodCostBuilding(int x, int y)
 {
     if (resourceGrid.GetTileType(x, y) == TileData.Types.desalt_s ||
         resourceGrid.GetTileType(x, y) == TileData.Types.nutrient ||
         resourceGrid.GetTileType(x, y) == TileData.Types.extractor ||
         resourceGrid.GetTileType(x, y) == TileData.Types.storage ||
         resourceGrid.GetTileType(x, y) == TileData.Types.farm_s)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
コード例 #3
0
    void SetStorageAndPump()
    {
        int mX = Mathf.RoundToInt(mouseEnd.x);
        int mY = Mathf.RoundToInt(mouseEnd.y);

        if (mX > 2 && mX < resourceGrid.mapSizeX - 2 && mY > 2 && mY < resourceGrid.mapSizeY - 2)
        {
            if (resourceGrid.GetTileType(mX, mY) == TileData.Types.storage)
            {
                selecting = false;

                buildingUI.currentlyBuilding = false;
//			lineR.enabled = false;
                // set my storage
                myStorage = resourceGrid.GetTileGameObj(mX, mY).GetComponent <Storage> ();
                // start pumping!!
                canPump = true;
            }
            else
            {
                Debug.Log("Need a place to store the water!");
            }
        }
    }