Added the Cutting Counter

This commit is contained in:
BuyMyMojo 2023-03-01 02:05:53 +11:00
parent 44837c6c13
commit 500f8f5f2a
41 changed files with 2383 additions and 70 deletions

View file

@ -28,6 +28,15 @@ public class Player : MonoBehaviour, IKitchenObjectParent
private void Start()
{
gameInput.OnInteractAction += GameInput_OnInteractAction;
gameInput.OnInteractAlteranteAction += GameInput_OnInteractAlteranteAction; ;
}
private void GameInput_OnInteractAlteranteAction(object sender, EventArgs e)
{
if (selectedCounter != null)
{
selectedCounter.InteractAlternate(this);
}
}
private void GameInput_OnInteractAction(object sender, System.EventArgs e)
@ -123,7 +132,7 @@ public class Player : MonoBehaviour, IKitchenObjectParent
// attempt only X move
Vector3 moveDirX = new Vector3(moveDir.x, 0, 0).normalized;
canMove = !Physics.CapsuleCast(transform.position, transform.position + Vector3.up * playerHeight, playerRadius, moveDirX, moveDistance);
canMove = moveDir.x != 0 && !Physics.CapsuleCast(transform.position, transform.position + Vector3.up * playerHeight, playerRadius, moveDirX, moveDistance);
// if able to move on X then change moveDir to X
if (canMove)
@ -134,7 +143,7 @@ public class Player : MonoBehaviour, IKitchenObjectParent
{
// cannot move on X so attempt to move on Z
Vector3 moveDirZ = new Vector3(0, 0, moveDir.z).normalized;
canMove = !Physics.CapsuleCast(transform.position, transform.position + Vector3.up * playerHeight, playerRadius, moveDirZ, moveDistance);
canMove = moveDir.z != 0 && !Physics.CapsuleCast(transform.position, transform.position + Vector3.up * playerHeight, playerRadius, moveDirZ, moveDistance);
// if able to move on Z then change moveDir to Z
if (canMove)