> =操作数不能应用于Bool和Float类型

Muf*_*fin -5 c# boolean operand

我有这个长篇大论.它给了我错误

>= Operand cannot be applied to types Bool and Float

if (tl.State == TouchLocationState.Pressed && 
    (tl.Position.X >= harePlayer.Position.X >= tl.Position.X && 
     tl.Position.Y >= harePlayer.Position.Y &&
     harePlayer.Position.X <= (harePlayer.Position.X + 52) &&
     tl.Position.Y <= (harePlayer.Position.Y + 50)))
Run Code Online (Sandbox Code Playgroud)

谁能告诉我修复是什么?谢谢.:)

Mar*_*zek 8

tl.Position.X >= harePlayer.Position.X >= tl.Position.X是不正确的c#条件.您必须编写两个单独的条件并使用&&以下方法合并它们:

tl.Position.X >= harePlayer.Position.X && harePlayer.Position.X >= tl.Position.X
Run Code Online (Sandbox Code Playgroud)