feat: receive input data from python
parent
d395793750
commit
fd9206f8d7
|
@ -1255,6 +1255,7 @@ MonoBehaviour:
|
||||||
width: 4.5
|
width: 4.5
|
||||||
height: 1
|
height: 1
|
||||||
_gravityScaleRange: {x: 0.1, y: 0.5}
|
_gravityScaleRange: {x: 0.1, y: 0.5}
|
||||||
|
_canvas: {fileID: 1939570966}
|
||||||
_time: {fileID: 1230716510}
|
_time: {fileID: 1230716510}
|
||||||
_score: {fileID: 1901652404}
|
_score: {fileID: 1901652404}
|
||||||
_itemPools:
|
_itemPools:
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using GadGame.Manager;
|
using GadGame.Manager;
|
||||||
|
using GadGame.Network;
|
||||||
using GadGame.State;
|
using GadGame.State;
|
||||||
using GadGame.State.GameState;
|
using GadGame.State.GameState;
|
||||||
using Pools.Runtime;
|
using Pools.Runtime;
|
||||||
|
@ -18,8 +19,9 @@ namespace GadGame.MiniGame
|
||||||
[SerializeField, Range(0,1)] private float _bombChange;
|
[SerializeField, Range(0,1)] private float _bombChange;
|
||||||
[SerializeField] private Rect _spawnArea;
|
[SerializeField] private Rect _spawnArea;
|
||||||
[SerializeField, MinMaxSlider(0, 2, true)] private Vector2 _gravityScaleRange;
|
[SerializeField, MinMaxSlider(0, 2, true)] private Vector2 _gravityScaleRange;
|
||||||
|
|
||||||
[Header("UI")]
|
[Header("UI")]
|
||||||
|
[SerializeField] private Canvas _canvas;
|
||||||
[SerializeField] private TextMeshProUGUI _time;
|
[SerializeField] private TextMeshProUGUI _time;
|
||||||
[SerializeField] private TextMeshProUGUI _score;
|
[SerializeField] private TextMeshProUGUI _score;
|
||||||
|
|
||||||
|
@ -69,9 +71,15 @@ namespace GadGame.MiniGame
|
||||||
|
|
||||||
public void PlayerControl()
|
public void PlayerControl()
|
||||||
{
|
{
|
||||||
if (Input.GetMouseButton(0))
|
//640x480;
|
||||||
|
var inputData = DataReceiver.Instance.DataReceived.PosPoint;
|
||||||
|
var inputNormalize = new Vector2(inputData.x / 640, inputData.y / 480);
|
||||||
|
var input = new Vector2();
|
||||||
|
input.x = Mathf.Lerp(0, _canvas.pixelRect.width, inputNormalize.x);
|
||||||
|
input.y = -Mathf.Lerp(0, _canvas.pixelRect.height, inputNormalize.y);
|
||||||
|
if (input != Vector2.zero)
|
||||||
{
|
{
|
||||||
var mousePos = Input.mousePosition;
|
var mousePos = input;
|
||||||
var pos = _camera.ScreenToWorldPoint(mousePos);
|
var pos = _camera.ScreenToWorldPoint(mousePos);
|
||||||
var currentPosition = _basket.position;
|
var currentPosition = _basket.position;
|
||||||
pos.y = currentPosition.y;
|
pos.y = currentPosition.y;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
|
||||||
|
|
||||||
namespace GadGame.Network
|
namespace GadGame.Network
|
||||||
{
|
{
|
||||||
|
@ -19,5 +18,6 @@ namespace GadGame.Network
|
||||||
public Genders Gender;
|
public Genders Gender;
|
||||||
public int AgeMin;
|
public int AgeMin;
|
||||||
public int AgeMax;
|
public int AgeMax;
|
||||||
|
public Vector2 PosPoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue