fixed issues in PlayerInteraction & PlayerMovement

This commit is contained in:
AgentSchmisch 2025-06-17 15:33:25 +02:00
parent 21423930ce
commit 483eeb54a8
2 changed files with 15 additions and 3 deletions

View File

@ -28,7 +28,7 @@ public class PlayerInteraction : MonoBehaviour
DialogAction.action.performed += onDialogContinue; DialogAction.action.performed += onDialogContinue;
dialogManager = dialogManagerObject.GetComponent<DialogManager>(); dialogManager = dialogManagerObject.GetComponent<DialogManager>();
print(dialog.Length);
} }
void OnInteract(InputAction.CallbackContext context) void OnInteract(InputAction.CallbackContext context)
@ -64,8 +64,7 @@ public class PlayerInteraction : MonoBehaviour
void onDialogContinue(InputAction.CallbackContext context) void onDialogContinue(InputAction.CallbackContext context)
{ {
if (context.performed && dialog != null && dialog.Length > 0)
if (context.performed && dialog != null)
{ {
// scroll the dialog only if there is text to be shown // scroll the dialog only if there is text to be shown
@ -87,6 +86,10 @@ public class PlayerInteraction : MonoBehaviour
{ {
} }
public int GetBlueberryCount()
{
return blueberryCount;
}
public void CollectBlueberry(int newBlueberries) public void CollectBlueberry(int newBlueberries)
{ {

View File

@ -20,6 +20,15 @@ public class PlayerMovement : MonoBehaviour
private Vector3 inputDirection = Vector3.zero; private Vector3 inputDirection = Vector3.zero;
private CharacterController controller; private CharacterController controller;
void Awake()
{
if (cameraTransform == null)
{
cameraTransform = Camera.main.transform;
}
}
void Start() void Start()
{ {
controller = GetComponent<CharacterController>(); controller = GetComponent<CharacterController>();