コード例 #1
0
ファイル: GameController.cs プロジェクト: JTSenneker/ZenMoon
    /// <summary>
    /// Places seeds on the grid
    /// </summary>
    void PlaceSeeds()
    {
        GameObject tile = JDMouseTargeting.target;

        if (tile != null)
        {
            JDGroundClass.tiles tileType = tile.GetComponent <JDGroundClass>()._tileStatus;
            if (tileType == JDGroundClass.tiles.tilled)
            {
                GameObject newSeeds = (GameObject)Instantiate(seeds, tile.transform.position, Quaternion.identity);
                newSeeds.GetComponent <JDPlantClass>().seedType    = playerCon.invCon.currItem.GetComponent <JDPlantClass>().seedType;
                newSeeds.GetComponent <JDPlantClass>().plantedTile = tile;
                tile.GetComponent <JDGroundClass>().occupiedWith   = newSeeds;
            }
        }
    }
コード例 #2
0
ファイル: GameController.cs プロジェクト: JTSenneker/ZenMoon
    /// <summary>
    /// Switches the tiles according to what tool the player is using to interact with the grid
    /// </summary>
    void SwitchTile()
    {
        GameObject tile = JDMouseTargeting.target;

        if (tile != null)
        {
            JDGroundClass.tiles tileType = tile.GetComponent <JDGroundClass>()._tileStatus;
            if (playerCon.invCon.currItem.GetComponent <Tool>().toolType == Tool.ToolType.hoe)
            {
                tile.GetComponent <JDGroundClass>()._tileStatus = JDGroundClass.tiles.tilled;
            }
            if (playerCon.invCon.currItem.GetComponent <Tool>().toolType == Tool.ToolType.wateringCan && tileType == JDGroundClass.tiles.tilled)
            {
                tile.GetComponent <JDGroundClass>()._tileStatus = JDGroundClass.tiles.watered;
            }
        }
    }