C# & Unity 공부(34)
-
3-2. 키보드와 마우스로 입력 받아 이동시키기
using System.Collections; using System.Collections.Generic; using UnityEngine; public class LifeCycle : MonoBehaviour { /*void Start() { //Transform은 오브젝트가 있으면 무조건 있다. Transform도 하나의 클래스이다. //밑의 transform은 변수 //Vector3은 3차원, Vector2는 2차원을 나타내는 클래스 //Translate(Vector)은 안의 크기만큼 이동시키는 함수 Vector3 vec = new Vector3(0, -3, 0); transform.Translate(vec); //y축으로 -3만큼 이동 }*/ /*void Update() { Vector3 vec ..
2023.06.30 -
3-1. 키보드와 마우스로 입력 받아 이동시키기
using System.Collections; using System.Collections.Generic; using UnityEngine; public class LifeCycle : MonoBehaviour { void Update() { //Input은 게임 내 모든 입력을 관리하는 클래스 (기본으로 제공) if (Input.anyKeyDown) //anyKeyDown : 아무 키를 최로 받을 때 true 값을 출력함 (Bool 형태 반환, 변수) Debug.Log("플레이어가 아무 키를 눌렀습니다."); /*if (Input.anyKey) //anyKey : 아무 키를 누르고 있을 떄 true 값을 출력함 (Bool 형태 반환, 변수) Debug.Log("플레이어가 아무 키를 누르고 있습니다.")..
2023.06.30 -
2. LifeCycle에 관하여 - (정리 필요)
using System.Collections; using System.Collections.Generic; using UnityEngine; public class LifeCycle : MonoBehaviour { //1. 초기화 영역 void Awake() //게임 오브젝트 생성할 때, 최초 실행 { Debug.Log("플레이어 데이터가 준비되었습니다."); } //1.5. 초기화 영역와 물리 영역 사이에 있음 void OnEnable() //게임 오브젝트가 활성화 되었을 때, 최초 실행이 아닌 오브젝트를 키고 끄고 할때마다 실행됨 { Debug.Log("플레이어가 로그인했습니다."); } void Start() //업데이트 시작 직전, 최초 실행(초기화 영역) { Debug.Log("사냥 장비를 챙겼..
2023.06.29 -
1. C# 간단한 정리 - (정리 필요)
using System.Collections; using System.Collections.Generic; using UnityEngine; public class NewBehaviourScript : MonoBehaviour { int health = 30; int level = 5; float strength = 15.5f; string playerName = "나검사"; bool isFullLevel = false; int exp = 1500; string title = "전설의"; int mana = 25; // Start is called dbefore the first frame update void Start() { Debug.Log("Hello Unity!"); //1.변수 /*int le..
2023.06.29