private void Chop_P1(InputAction.CallbackContext obj) { if (!attached && playerNumber == 1) { tool.ChopEvent(playerNumber); SendMessage("playCutSound", 1); } }
void CheckPlayerTwoKeys(float deltaX, float deltaY, PlayerTool tool) { if (attached == false) { if (deltaX > 0 || deltaX < 0) { movementVector.x = deltaX; if (deltaX < 0) { SetDirectionSprite(leftSprite, (int)DirectionIndex.left); } else { SetDirectionSprite(rightSprite, (int)DirectionIndex.right); } } if (deltaY > 0 || deltaY < 0) { movementVector.y = deltaY; if (deltaY < 0) { SetDirectionSprite(downSprite, (int)DirectionIndex.down); } else { SetDirectionSprite(upSprite, (int)DirectionIndex.up); } } if (deltaY > 0 && deltaX < 0 || deltaY > 0 && deltaX > 0) { spriteRendererComponent.sprite = upSprite; } if (deltaY < 0 && deltaX < 0 || deltaY < 0 && deltaX > 0) { spriteRendererComponent.sprite = downSprite; } rigidBody.velocity = movementVector * movementSpeed; movementVector.x = 0; movementVector.y = 0; checkAnimation(); } else if (attached == true) { PlayerTwoLogMovement(deltaY); } if (!attached && Input.GetButtonDown("Player2 Attach")) { Attach(); operationDone = true; } if (attached && Input.GetButtonDown("Player2 Attach")) { if (operationDone != true) { Detach(); } } if (!attached && Input.GetButton("Player2 Chop")) { tool.ChopEvent(playerNumber); } else { } operationDone = false; }