K-digital traning/유니티 심화 7

[주말과제]UGUI+데이터연동(2)

앞서 gold에 관해서 해보았고 이번에는 gem을 해보도록 하자 앞서 해놓았던 부분에서 약간만 수정하면 된다. 1.데이터 연동 (1)gem_data 엑셀 파일을 만든다. (2)엑셀 파일을 기반으로 json 파일을 만든다. (3)Resources 폴더에 넣는다. 2.Atlas 생성 3.코드 using System.Collections; using System.Collections.Generic; using UnityEngine; public class GemData { public int id; public string name; public int type; public int value; public float price; public string icon_name; public float pos_x;..

[주말과제]UGUI+데이터 연동(1)

*구현해야 되는 부분 1. 구조 잡기 2. scrollview test (1) UIMain 자식으로 UIPageShop이라는 gameObject를 생성. 그리고 그 자식으로 UIScrollview 이미지를 만들어 스크롤 영역(이미지를 보여주고자 하는 영역)을 잡고 content gameObject를 생성한 뒤 왼쪽 상단에 부착한다. (2) content gameObject에 Content Size Fitter 컴포넌트를 부착하고 Horizontal Fit과 Vertical Fit의 설정을 Preferred Size로 변경한다. 다음 UIGoldCell을 수평으로 정렬하기 위해 Horizontal Layout Group 컴포넌트를 부착한다. (3) UIGoldCell을 여러 개 만든 다음 content에 ..

HeroShooter에 new Input System 적용

(1) TEST - Player에 부착된 Player Event Controller 스크립트 using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; public class PlayerEventController : MonoBehaviour { private Vector3 moveDir = Vector3.zero; //public private Animator anim; // Start is called before the first frame update void Start() { this.anim=this.GetComponent(); } ..

[주말과제] 궁수의 전설

1.현재 구현 - 플레이어 이동(조이스틱 or 키보드 둘 중 하나로 가능) - 플레이어 공격(몬스터가 살아있는 상태에서 조이스틱을 놓을 경우(or 키보드를 건드리지 않을 경우) 플레이어는 몬스터를 공격) - 플레이어 Idle(몬스터가 죽은 상태에서는 이동하지 않는 한 기본 상태) - 몬스터는 아직 한 마리 구현 ->generator를 구현하였으나 아직 게임을 관리해줄 game main을 못 만든 상태,, - 몬스터 hp가 다 닳으면 소멸되도록 구현 2.구현 코드 (1) Player using System.Collections; using System.Collections.Generic; using UnityEngine; public class Player : MonoBehaviour { public en..