add shovel and digging, basic item interaction

This commit is contained in:
2025-06-25 22:03:13 -05:00
parent 0eda440961
commit 16c8519111
22 changed files with 2412 additions and 38 deletions
+11 -1
View File
@@ -3,6 +3,7 @@
public class PlayerController : MonoBehaviour
{
public GameObject DougBody;
public Shovel Shovel;
public float walkSpeed;
Interactable nearestInteractable;
@@ -10,7 +11,7 @@ public class PlayerController : MonoBehaviour
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
@@ -19,6 +20,7 @@ void Update()
RotatePlayerTowardMouse();
Walk();
TryInteract();
DigDetector();
}
void Walk()
@@ -27,6 +29,14 @@ void Walk()
transform.position += DougBody.transform.right * Input.GetAxis("Horizontal") * walkSpeed * Time.deltaTime;
}
void DigDetector()
{
if (Input.GetMouseButtonDown(0))
{
Shovel.Dig();
}
}
void RotatePlayerTowardMouse()
{
Vector2 positionOnScreen = Camera.main.WorldToViewportPoint(DougBody.transform.position);