master
tiendat3699 2024-04-16 14:21:29 +07:00
parent cd55afd82b
commit c963f7a5fe
2 changed files with 10 additions and 7 deletions

View File

@ -1246,7 +1246,6 @@ MonoBehaviour:
GameTime: 60 GameTime: 60
_basket: {fileID: 1254852291} _basket: {fileID: 1254852291}
_lerp: 10 _lerp: 10
_speed: 10
_spawnTime: 0.5 _spawnTime: 0.5
_bombChange: 0.2 _bombChange: 0.2
_spawnArea: _spawnArea:
@ -1255,7 +1254,7 @@ MonoBehaviour:
y: 7 y: 7
width: 4.5 width: 4.5
height: 1 height: 1
_gravityScaleRange: {x: 0.1, y: 0.5} _gravityScaleRange: {x: 0.05, y: 0.2}
_canvas: {fileID: 1939570966} _canvas: {fileID: 1939570966}
_time: {fileID: 1230716510} _time: {fileID: 1230716510}
_score: {fileID: 1901652404} _score: {fileID: 1901652404}

View File

@ -73,10 +73,12 @@ namespace GadGame.MiniGame
{ {
//640x480; //640x480;
var inputData = DataReceiver.Instance.DataReceived.PosPoint; var inputData = DataReceiver.Instance.DataReceived.PosPoint;
var inputNormalize = new Vector2(inputData.x / 230, inputData.y / 480); var inputNormalize = new Vector2((inputData.x - 213.33f)/ 213.33f, inputData.y / 480);
var input = new Vector2(); var input = new Vector2
input.x = Mathf.Lerp(0, _canvas.pixelRect.width, inputNormalize.x); {
input.y = -Mathf.Lerp(0, _canvas.pixelRect.height, inputNormalize.y); x = Mathf.Lerp(0, _canvas.pixelRect.width, inputNormalize.x),
y = -Mathf.Lerp(0, _canvas.pixelRect.height, inputNormalize.y)
};
if (input != Vector2.zero) if (input != Vector2.zero)
{ {
var mousePos = input; var mousePos = input;
@ -85,7 +87,9 @@ namespace GadGame.MiniGame
pos.x *= -1; pos.x *= -1;
pos.y = currentPosition.y; pos.y = currentPosition.y;
pos.z = 0; pos.z = 0;
_basket.position = Vector3.Lerp(currentPosition, pos, _lerp * Time.deltaTime); currentPosition= Vector3.Lerp(currentPosition, pos, _lerp * Time.deltaTime);
currentPosition.x = Mathf.Clamp(currentPosition.x, -2.25f, 2.25f);
_basket.position = currentPosition;
} }
} }