| | |
| | | { |
| | | get |
| | | { |
| | | return animator.GetBool(AnimationStrings.canMove) && !PauseMenu.GameIsPaused; |
| | | return animator.GetBool(AnimationStrings.canMove) && !PauseMenu.GameIsPaused && !IsDrilling; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | private void FixedUpdate() |
| | | { |
| | | if (CanMove) |
| | | { |
| | | if (moveInput.y == 0) |
| | | { |
| | |
| | | //IsDrilling = true; |
| | | Drill(DrillDirection.Down); |
| | | } |
| | | if (touchingDirections.IsGrounded && touchingDirections.IsAtWall && moveInput.x != 0 && !IsDrilling) |
| | | |
| | | if (touchingDirections.IsGrounded && moveInput.x != 0 && !IsDrilling) |
| | | { |
| | | //IsDrilling = true; |
| | | if (touchingDirections.IsAtWallLeft) |
| | | if (touchingDirections.IsAtWallLeft && moveInput.x < 0) |
| | | { |
| | | Drill(DrillDirection.Left); |
| | | } |
| | | else if (touchingDirections.IsAtWallRight) |
| | | else if (touchingDirections.IsAtWallRight && moveInput.x > 0) |
| | | { |
| | | Drill(DrillDirection.Right); |
| | | } |
| | | } |
| | | } |
| | | if (IsDrilling) |
| | | { |
| | | rb.velocity = Vector2.zero; |
| | | if (timeSinceDrill > drillingTime) |
| | | { |
| | | IsDrilling = false; |
| | |
| | | |
| | | public void OnMove(InputAction.CallbackContext context) |
| | | { |
| | | if (CanMove) |
| | | { |
| | | moveInput = context.ReadValue<Vector2>(); |
| | | |
| | | IsMoving = moveInput.x != 0; |
| | |
| | | IsFlying = (moveInput.y != 0); |
| | | |
| | | SetFacingDirection(moveInput); |
| | | |
| | | } |
| | | else |
| | | if (IsDrilling) |
| | | { |
| | | IsMoving = false; |
| | | IsFlying = false; |
| | | moveInput = Vector2.zero; |
| | | //moveInput = Vector2.zero; |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | IsDrilling = true; |
| | | ContactPoint2D[] contactPoints = new ContactPoint2D[1]; |
| | | Debug.Log("drillDirection: " + drillDirection.ToString()); |
| | | //rb.GetContacts(contactPoints); |
| | | if (drillDirection == DrillDirection.Down) |
| | | switch (drillDirection) |
| | | { |
| | | case DrillDirection.Left: |
| | | touchingDirections.wallHitsLeft[0].collider.GetContacts(contactPoints); |
| | | break; |
| | | case DrillDirection.Right: |
| | | touchingDirections.wallHitsRight[0].collider.GetContacts(contactPoints); |
| | | break; |
| | | case DrillDirection.Down: |
| | | touchingDirections.groundHits[0].collider.GetContacts(contactPoints); |
| | | } else if (drillDirection == DrillDirection.Left || drillDirection == DrillDirection.Right) |
| | | { |
| | | touchingDirections.wallHits[0].collider.GetContacts(contactPoints); |
| | | break; |
| | | } |
| | | CharacterEvents.characterDrill.Invoke(contactPoints[0], drillDirection); |
| | | } |