void UpdateTouchPosition()
{
if (_frameGotTouchPosition != Time.frameCount)
{
_frameGotTouchPosition = Time.frameCount;
if (_customInput)
{
_touchPosition = _customInputPos;
_touchPosition.y = stageHeight - _touchPosition.y;
}
else if (touchScreen)
{
for (int i = 0; i < Input.touchCount; ++i)
{
Touch uTouch = Input.GetTouch(i);
_touchPosition = uTouch.position;
_touchPosition.y = stageHeight - _touchPosition.y;
}
}
else
{
Vector2 pos = Input.mousePosition;
if (pos.x >= 0 && pos.y >= 0) //编辑器环境下坐标有时是负
{
pos.y = stageHeight - pos.y;
_touchPosition = pos;
}
}
}
}