게임엔진/개인 플젝

    [Outdated] 농장 시뮬레이터 개인작

    요즘 핫하다는 농장게임 보면서 깃허브에 짱박아둔 플젝 하나가 생각났다 UI 및 게임 애니메이션을 구현하기 위해선 DoTween을 많이 사용한다아래는 DoLocalMoveX 함수로 간단하게 구현using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;using DG.Tweening;public class UI_manager : MonoBehaviour{ public static UI_manager instance; public GameObject menu_obj; //public Text money_text; bool m_is_opened = false; int m..

    플레이어 방향에 따른 발사 위치 변경

    빈 오브젝트를 총기의 끝부분에 설정 후 발사 위치를 설정, 예전에 짠 코드라 많이 지저분함 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Weapon_manager : MonoBehaviour { // 싱글톤 public static Weapon_manager instance; // 플레이어 총기 관련 public Transform player_transform; public GameObject player_gun_prefab; public GameObject weapon_creation_pos_obj; GameObject player_gun_object; GameObject player..

    Flow Free 3 - UI

    UI Manager - 모든 UI들을 관리 / 로직 포함 캔버스에 직접 스크립트 추가하여 나머지 UI들은 자동으로 연동 딱히 다른 클래스 만들어서 이를 상속 받아 팝업 형태 할 정도로 개수가 많지 않아서 단순하게 구현 using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.SceneManagement; public class UI_Manager : SingletonLocal { [SerializeField] GameObject GameUI_Prefab; public GameUI g..

    Flow Free 2 - 슬롯(그리드)과 파이프(연결선)

    게임 매니저가 맨 후순위로 와야한다 슬롯 생성 맵에 존재하는 모든 그리드들이 Slot.cs 기반이 될거다, 실제로는 임의의 위치에 동그라미 생성을 해야하기 때문에 2개의 이미지를 겹쳐놨다, 추가로 Slot.cs는 선 색상, 이어서 할 수 있는 동그라미 정보 등 Grid 관련 데이터를 들고 있을거다. 아래는 옵션 Slot.cs using UnityEngine; using UnityEngine.UI; public class Slot : MonoBehaviour { RectTransform rect; public Image img; // 선 관련 정보 public Color color; public Vector3 pipePos; public int idx = 0; private void Awake() { im..

    Flow Free 1 - 그리드 (맵) 생성

    Grid Manager.cs 프리팹 생성 후 우클릭해서 사이즈에 맞게끔 생성 void InitGrid(int size) { gridObj = Instantiate(new GameObject(), transform); var layoutGroup = gridObj.AddComponent(); gridObj.name = $" Grid {size}x{size} "; var rect = gridObj.transform as RectTransform; rect.localPosition = mPos; rect.sizeDelta = mSlotSize; layoutGroup.padding.left = mLeftPadding; layoutGroup.spacing = new Vector2(15f, 15f); layoutG..

    [Unity] Flow Free 게임 카피캣 만들기

    UI 관한 로직 - UIManager.cs using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.SceneManagement; public class UI_Manager : SingletonLocal { public GameUI GameUI_Obj; public ResultUI ResultUI_Obj; int mLayer; bool isCreatedResUI = false; // 파이프 UI 용도 public Canvas pipeUI_CanvasPrefab = null; Canv..