본문 바로가기

분류 전체보기183

23/08/08 복습 - 내용정리 ※헷갈리는 부분※ - SerializedField 사용하는 이유 - namespace 사용하는 이유 - main스크립트와 controller스크립트에 각각 어떤 내용들이 들어가야하는지 - CoRutine(코루틴) 사용이유 & 사용법 ※SerializedField 사용하는 이유? : private으로 선언한 변수 또는 비공개 필드를 인스펙터(inspector)에서 접근 가능하게 해주기 위해! : 단, 외부스크립트에서 수정 불가! ※ namespace 사용하는 이유? : 스크립트 클래스의 이름이 같아 생기는 충돌 방지, 클래스들을 그룹별로 묶어서 관리! : namespace안의 클래스들을 사용할 수 있음 (참고 사이트) https://coderzero.tistory.com/entry/%EC%9C%A0%EB%.. 2023. 8. 8.
23/08/08 캐릭터 이동 및 몬스터 공격하기 Main using System.Collections; using System.Collections.Generic; using test; using UnityEngine; using UnityEngine.UI; public class Test_PlayerControlSceneMain : MonoBehaviour { [SerializeField] private HeroController heroController; void Start() { this.heroController.onMoveComplete = (target) => { Debug.LogFormat("이동을 완료했습니다.: {0}",target); //타겟이 있다면 공격 애니메이션 실행 if(target != null) { this.heroCon.. 2023. 8. 8.
23/08/07 과제-복습 유니티 설치 오류를 어느정도 해결했다고 생각했는데.... 깃허브에서 작업한 파일 불러오기에서 오류가 또 발생했다.... 아마 에디터 호환이 문제가 되는것 같은데 이것저것 시도해도 똑같다... 내일 학교에가서 파일을 다시 옮겨서 붙여넣기 해보겠습니다.... 아래 프로젝트들은 불러오기 파일이 아닌 여기 허브에서 새로 생성한 파일들입니다.. 2023. 8. 7.
23/08/07 AppleCatch ray를 찍은 위치로 바구니 위치 변경(칸에 맞춰서 이동 x) using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using UnityEngine; public class BasketController : MonoBehaviour { // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { //마우스 왼쪽 클릭하면(화면 터치) Ray를 만들자 if (Input.GetMouseButtonDown(0)) { //화면상의 좌표 -> Ra.. 2023. 8. 7.
23/08/06 [주말과제] 캐릭터 위치 이동 및 몬스터 공격(수정) 스크립트 예상해보기 1. 클릭한 곳을 월드좌표상 Ray객체로 생성 2. 클릭한 곳을 타겟으로 하여 캐릭터 이동시키고 멈추기 3. 몬스터가 타겟이 되면 공격 애니메이션 재생 4. 공격 중에 다른 곳을 클릭하면 클릭한 곳으로 다시 이동후 멈추기 1,2) 클릭한 곳까지 캐릭터 이동시키고 도착하면 멈추기 using System.Collections; using System.Collections.Generic; using UnityEngine; public class DogController : MonoBehaviour { public Transform target; private Animator anim; private bool isMoveStart = false; private Vector3 targetPos.. 2023. 8. 6.
23/08/06 유니티 기초 복습(CatEscape, Bamsongi) 2. Bamsongi 1) 밤송이 던져서 과녁(타겟)에 맞춰서 붙게하기 using System.Collections; using System.Collections.Generic; using UnityEngine; public class BamsongiController : MonoBehaviour { public Rigidbody rBody; [SerializeField] private float forwardForce = 2000; private void Awake() { this.rBody = this.GetComponent(); } // Start is called before the first frame update void Start() { Debug.Log("Start"); this.Shoot.. 2023. 8. 6.