我正在尝试制作自己的游戏。我有一个角色,我正在尝试使其跳跃。我可以使角色行走,闲置和滑动,但不会跳动。我正在用1个脚本进行所有编码。我收到了附带的错误消息,但不确定如何解决。我已经尝试了很多方法,但是都无法正常工作。
public async Task<WorkItem> GetWork()
{
WorkItem wi;
try
{
wi = await _inputQueue.ReceiveAsync(new TimeSpan(0, 0, 1));
}
catch (Exception)
{
//since we supplied a timeout, this will be thrown if no items come back
return null;
}
return wi;
}
答案 0 :(得分:0)
将字段private bool IsGrounded;
重命名为private bool isGround;
还需要将方法名称private bool isGround() {}
更改为private bool IsGrounded() {}
然后从instance
方法中删除IsGrounded
。
private bool IsGrounded()
{
if (myRigidbody.velocity.y <= 0)
{
foreach (Transform point in groundPoints)
{
Collider2D[] colliders = Physics2D.OverlapCircleAll(point.position, groundRadius, whatisGround);
for (int i = 0; i < colliders.Length; i++)
{
if (colliders[i].gameObject != gameObject)
{
return true;
}
}
}
}
return false;
}