【发布时间】:2020-11-16 10:58:52
【问题描述】:
我有这个简单的代码。我已经使用 if 语句来检查如果我按下暂停按钮,跳转动画将不会被触发。激活暂停菜单后,当我点击恢复时,游戏将立即开始,角色将立即跳跃。 我曾尝试使用实时和 time.timeScale = 0.001 的协程,但仍会触发操作。关于如何解决的任何想法?
private void Jump()
{
if (Input.touchCount > 0 && rb.velocity.y == 0 && Input.GetTouch(0).phase == TouchPhase.Began)
{
startTouchPosition = Input.GetTouch(0).position;
if (startTouchPosition.x < screenMinusButton.x || startTouchPosition.y < screenMinusButton.y)
rb.velocity = new Vector2(rb.velocity.x, jumpForce);
}
}
【问题讨论】:
-
这个问题可能对你有帮助:stackoverflow.com/questions/32095383/…
-
我还得再学一点,我对那个话题一无所知。谢谢
标签: c# visual-studio unity3d