private bool CheckWaterInRange() { bool resultado = false; // check from 1 to 4 (min to max distance), if the block is water... if water is in range, returns true otherwise returns false. // the player CANNOT fish on a toilet or in water in hole // so i'll correct the function so that it checks if it is at least 2 blocks deep and has 2 water blocks to each side. // because I dont want them fishing on a pond for (int i = 1; i <= 4; i++) { Vector3i vv = Vector3i.FromVector3Rounded(epLocalPlayer.GetLookRay().GetPoint(i)); BlockValue valor = GameManager.Instance.World.GetBlock(vv); Block block = Block.list[valor.type]; if (block.blockMaterial.IsLiquid && (block.GetBlockName() == "water" || block.GetBlockName() == "waterMoving")) { //check deepness vPlace = vv; vv.y++; // needs to check if there's air on top of water valor = GameManager.Instance.World.GetBlock(vv); block = Block.list[valor.type]; if (valor.type == 0) { return(true); } } } return(resultado); }
public void FindSurroundingBlocks(string callingFunction) { Vector3 vehicleFullPos = gameObject.transform.position; vehicleFullPos.y += 0.5f; Vector3i vehiclePos = Vector3i.FromVector3Rounded(vehicleFullPos); Vector3i blockPos = vehiclePos; for (int i = -5; i < 6; i++) { blockPos.x = vehiclePos.x + i; for (int j = -5; j < 6; j++) { blockPos.z = vehiclePos.z + j; BlockValue blockValue = GameManager.Instance.World.GetBlock(currentClrIdx, blockPos); Block block = Block.list[blockValue.type]; string blockName = block.GetBlockName(); //if (blockName != "air" && blockName != lastHitBlock) if (blockName != "" && blockName != "air") { Debug.Log(callingFunction + ": " + block.GetType().ToString() + " | " + blockName); //lastHitBlock = blockName; } } } }
private bool CheckWaterInRange() { bool resultado = false; // check from 1 to 4 (min to max distance), if the block is water... if water is in range, returns true otherwise returns false. // the player CANNOT fish on a toilet or in water in hole // so i'll correct the function so that it checks if it is at least 2 blocks deep and has 2 water blocks to each side. // because I dont want them fishing on a pond for (int i = 1; i <= 4; i++) { Vector3i vv = Vector3i.FromVector3Rounded(epLocalPlayer.GetLookRay().GetPoint(i)); BlockValue valor = GameManager.Instance.World.GetBlock(vv); Block block = Block.list[valor.type]; if (block.blockMaterial.IsLiquid && (block.GetBlockName() == "water" || block.GetBlockName() == "waterMoving")) { //check deepness int deepNessAux = 1; for (int j = 1; j <= 10; i++) { vv.y = vv.y - 1; valor = GameManager.Instance.World.GetBlock(vv); block = Block.list[valor.type]; if (block.blockMaterial.IsLiquid && (block.GetBlockName() == "water" || block.GetBlockName() == "waterMoving")) { deepNessAux++; } else { break; } } deepNess = deepNessAux; //DisplayChatAreaText("Deepness = " + deepNess); //"waterMovingBucket" and "waterSource8" will not be considered valid blocks for fishing return(true); } } return(resultado); }