using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GamePadController : MonoBehaviour {
ย ย public Button upButton;
ย ย public Button downButton;
ย ย public Button leftButton;
ย ย public Button rightButton;
ย ย public bool showLog;
ย ย // Override to use Method
ย ย protected virtual void OnClickLeftButton()
ย ย {
ย ย }
ย ย protected virtual void OnClickRightButton()
ย ย {
ย ย }
ย ย protected virtual void OnClickUpButton()
ย ย {
ย ย }
ย ย protected virtual void OnClickDownButton()
ย ย {
ย ย }
ย ย public void ButtonClickEvent(Button pressdButton)
ย ย {
ย ย ย ย if(showLog) Debug.Log(pressdButton.name + "is pressed");
ย ย ย ย if (pressdButton == leftButton)
ย ย ย ย {
ย ย ย ย ย ย OnClickLeftButton();
ย ย ย ย }
ย ย ย ย if (pressdButton == rightButton)
ย ย ย ย {
ย ย ย ย ย ย OnClickRightButton();
ย ย ย ย }
ย ย ย ย if (pressdButton == upButton)
ย ย ย ย {
ย ย ย ย ย ย OnClickUpButton();
ย ย ย ย }
ย ย ย ย if (pressdButton == downButton)
ย ย ย ย {
ย ย ย ย ย ย OnClickDownButton();
ย ย ย ย }
ย ย }
}
์๋์ฒ๋ผ ๊ด๋ฆฌํ์ผ ํ๋ ์๊ณ ๊ฑฐ๊ธฐ์ ์ค๋ธ์ ํธ๋ค ID ๋ง๋ค์ด์ ํ๋ฒ์ ๊ด๋ฆฌํ๋ฉด ํธํ ๊ฒ๊ฐ์๋ฐ
๋ณดํต ๋ง๋ค์ด์ ์ฐ์ง...