게임프로그래밍/C++ 게임 클라 (3) 썸네일형 리스트형 #03 유니티 InputManager 아래는 인풋매너저를 적용한 코드이다. InputManager.csusing System;using System.Collections;using System.Collections.Generic;using UnityEngine;public class InputManager{ public Action KeyAction = null; public void OnUpdate() { if (Input.anyKey == false) return; if (KeyAction != null) KeyAction.Invoke(); }} Managers.csusing System.Collections;using System.Collections.. #02 유니티 플레이어 이동 키의 입력은 받는 Input.GetKey를 이용 하여 플레이어의 이동을 조작할수 있다. transform.position = 백터값 입력을 하면 플레이어의 포지션을 이동 할 수 있다.Vector3( x 좌표, y좌표, z좌표) 를 이용하여 아래 코드와 같이 이동 로직을 구현 할 수있다.using System.Collections;using System.Collections.Generic;using UnityEngine;public class PlayerController : MonoBehaviour{ void Start() { } // GameObject (Player) // Transform // PlayerController (*) v.. #01 유니티 게임 오브잭트 코드로 가져오기(Find, AddComponent, DontDestroyOnLoad) GameObject.Find("오브잭트 이름"); 으로 유니티 게임내 오브잭트를 가져올 수 있다.using System.Collections;using System.Collections.Generic;using UnityEngine;public class Player : MonoBehaviour{ // Start is called before the first frame update void Start() { // 게임오브잭트를 이름을 찾는거 자체가 부하가 심하다. /*GameObject go = GameObject.Find("@Managers"); Managers mg = go.GetComponent();*/ // 해결책: 싱글톤을 적용.. 이전 1 다음