/// <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; } } }
/// <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; } } }