본문 바로가기

게임프로그래밍

(6)
[MMO Lab 1기] 싱글톤(Singleton) ** 싱글톤 : 딱 하나만 객체가 존재 ㄴ 매니저를 구현할 때, 싱글톤으로 구현한다 ㄴ static 변수를 이용한다 => static은 클래스에 종속적이다고 표현 가능 using UnityEngine; public class Managers : MonoBehaviour { static Managers s_instance; public static Managers Instance { get { Init(); return s_instance; } } public static void Init() { if (s_instance == null) { GameObject go = GameObject.Find("@Managers"); if (go == null) { go = new GameObject() { name..
[MMO Lab 1기] 매니저(Managers) ** 컨포넌트를 이용해서 기능을 세분화하여 작업함 컨포넌트는 자신만의 기능을 세분화여 들고 있지만, 범용적으로 항상 사용하는 기능도 컨포넌트로 구현할 것인가? 그렇다면 그 내용들을 어떻게 공유하고 구현할 것이며 호출할 것인가? => 그에 대한 해답 중 하나가 매니저이다. ** 매니저(Managers) : 만능형으로, 모든 기능을 종합적으로 관리하는 역할 이 기능의 핵심은 우리가 작업하는 코드 내에서 언제 언디서든 사용 가능하다는 점 ㄴ 여러 개의 컨포넌트들이 따로 떨어져 있을 때, 교류하여 작업하는 방식 ▼ 매니저 using UnityEngine; public class Managers : MonoBehaviour { // Start is called before the first frame update..
[MMO Lab 1기] 유니티 2022.03 매뉴얼 ** 유니티 2022.03 매뉴얼 바로가기 https://docs.unity3d.com/Manual/ Unity - Manual: Unity User Manual 2022.3 (LTS) Use the Unity Editor to create 2D and 3D games, apps, and experiences. Download the Editor at unity3d.com. The Unity User Manual helps you learn how to use the Unity Editor and its associated services. You can read it from start to finish, or use it as a r docs.unity3d.com
[MMO Lab 1기] GameObject vs Component ** 게임 오브젝트 > 컨포넌트, 스크립트(동작을 부여) ** 게임 오브젝트(GameObjects)는 Unity의 기초적인 오브젝트로 캐릭터, 소품, 배경을 나타냄 독자적으로 많은 것을 하기보다는 실질적 기능을 수행하는 컴포넌트(Components) 의 컨테이너 역할 ** 컴포넌트는 해당 게임 오브젝트의 동작 정의 ** 유니티 생명주기 중 Awake, Start, Update 숙지하기 ㄴ Awake : 객체를 만들때 ㄴ Start : 게임 시작 ㄴ Update : 매 프레임마다 using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; public class NewBeha..
[MMO Lab 1기] Component 패턴 ** 컨포넌트(Component) : 여러 개의 프로그램 함수들을 모아 하나의 특정한 기능을 수행할 수 있도록 구성한 작은 기능적 단위 ㄴ 레고에 블록 쌓듯이 개발 ** 유니티에서 프레임? : Frame Per Second, 초당 프레임, 초당 화면에 몇 번 그려질지를 의미 using UnityEngine; public class Test : MonoBehaviour { // Start is called before the first frame update void Start() { Debug.Log("Hellow Unity"); } // Update is called once per frame void Update() { transform.Rotate(0, 1, 0); } } ** 공부할때, 참고한 블..
[MMO Lab 1기] 유니티 화면 세팅 1. Window > Layouts > 2 by 3 2. Ctrl + Shift + C = 콘솔창 띄우기 3. Game에서 Simulator로, 기종은 Samsung Galaxy S10e로 ** 최종 완성