나는 간단한 2 차원 탁구 게임을 만들고 있습니다. 이제 모든 문제가 끝났습니다. GUI 종료 또는 다시 시작 버튼 클릭이 기록되어서는 안되는 경우 기록된다는 것입니다. 두 선수가 손가락을 화면에 대고 움직여서 한 선수가 x 축에있는 버튼에서 25 유닛이고 다른 플레이어가 손가락으로 움직일 수있게합니다. 이 두 손가락 터치는 내 출구 버튼이 있고 앱이 닫힌 화면 가운데 한 손가락 터치로 어떻게 든 기록됩니다. 나는 선수 2 스크립트가 귀하의 버튼이 어디에 있는지 모르겠어요 2Unity3d 버튼을 클릭하지 않아도됩니다.
var speed : float = 10;
function Update() {
if (Input.touchCount > 0)
{
var touchDeltaPos:Vector2 = Input.GetTouch(0).position;
if(Input.touchCount>1)
var touchDeltaPos2:Vector2 = Input.GetTouch(1).position;
if(touchDeltaPos.x<Screen.width/2)
{
if(touchDeltaPos.y > Screen.height/2)
{
rigidbody2D.velocity.y = 1*speed;
}
else rigidbody2D.velocity.y = -1*speed;
}
else if(touchDeltaPos2.x<Screen.width/2&&Input.touchCount>1)
{
if(touchDeltaPos2.y > Screen.height/2)
{
rigidbody2D.velocity.y = 1*speed;
}
else rigidbody2D.velocity.y = -1*speed;
}
}
if (Input.touchCount == 0)
rigidbody2D.velocity.y = 0;
rigidbody2D.velocity.x=0;
}
유니티 3D를 처음 접한 이래로 어떻게 버퍼를 만드나요? – user3802649
@ user3802649 답변이 수정되었습니다. – Rika