update to unity 6.2, add save system and quest system
This commit is contained in:
@@ -6,6 +6,10 @@ public class PlayerController : MonoBehaviour
|
||||
public Shovel Shovel;
|
||||
public float walkSpeed;
|
||||
|
||||
float digTime = 0.9f;
|
||||
float digTimestamp = 0;
|
||||
bool isDigging = false;
|
||||
|
||||
Interactable nearestInteractable;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
@@ -17,9 +21,13 @@ void Start()
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
RotatePlayerTowardMouse();
|
||||
Walk();
|
||||
TryInteract();
|
||||
if (!isDigging)
|
||||
{
|
||||
RotatePlayerTowardMouse();
|
||||
Walk();
|
||||
TryInteract();
|
||||
}
|
||||
|
||||
DigDetector();
|
||||
}
|
||||
|
||||
@@ -31,9 +39,21 @@ void Walk()
|
||||
|
||||
void DigDetector()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
if (!isDigging)
|
||||
{
|
||||
Shovel.Dig();
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
Shovel.Dig();
|
||||
isDigging = true;
|
||||
digTimestamp = Time.time + digTime; // fuck coroutines fr fr
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Time.time > digTimestamp)
|
||||
{
|
||||
isDigging = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user