small fixes
This commit is contained in:
@@ -27,7 +27,6 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
{
|
||||
Debug.LogWarning(action);
|
||||
|
||||
Debug.LogWarning(player.GetComponent<PlayerInfo>().GetRightHand());
|
||||
if (player.GetComponent<PlayerInfo>().GetRightHand() != null)
|
||||
{
|
||||
|
||||
@@ -52,7 +51,13 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("WOODCUTTING ACTION");
|
||||
GameObject tree = FindTree();
|
||||
if (tree != null)
|
||||
{
|
||||
float distance = Vector3.Distance(transform.position, tree.transform.position);
|
||||
Debug.LogWarning("TREE FOUND: " + distance);
|
||||
if (distance < 6f) tree.GetComponent<CuttableTree>().Cut();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "VerticalLine":
|
||||
@@ -101,7 +106,7 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("WOODCUTTING ACTION");
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -172,6 +177,22 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
return null;
|
||||
}
|
||||
|
||||
GameObject FindTree()
|
||||
{
|
||||
Ray ray = playerCamera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
|
||||
RaycastHit hit;
|
||||
LayerMask playerLayerMask = LayerMask.GetMask("Player");
|
||||
if (Physics.Raycast(ray, out hit, playerLayerMask))
|
||||
{
|
||||
|
||||
if (hit.transform.gameObject.transform.name.StartsWith("Cuttable_Tree_"))
|
||||
{
|
||||
return hit.transform.gameObject;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void ShootProjectile()
|
||||
{
|
||||
Ray ray = playerCamera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
|
||||
|
||||
Reference in New Issue
Block a user