본문 바로가기

KDT/유니티 심화25

23/09/03 [주말] HeroShooter 총알 발사 지난 금요일에 배운 LoadAndSave 프로젝트가 Sourcetree에 잘 안올라가진 것 같다,,,ㅜㅜ 내일 다시 해봐야겠다! 주말에 그동안 HeroShooter 오류났던 것들 수정을 했다. - Hero가 Monster 감지할 때 Ray가 이상하게 나갔던 것 - 총알 발사할때 방향이 이상하게 나갔던 것 - 애니메이션 추가 등.. 그렇지만 역시나 이번에도 새로운 걸 하려보니 오류가 나 네^^,, 오류에 늪에서 벗어나려면 연습을 더 해야함을 느낀다... **오늘의 오류 - 총알 무한발사 (지난 번에 했던 코루틴 무한반복 방지 방법을 쓴 거 같은데도 무한 발사를 한다ㅜ ) Player using System.Collections; using System.Collections.Generic; using Sys.. 2023. 9. 3.
23/08/31 Input System 연습 4가지 방법 중에 send message 방법이 간단하고 좋은 것 같아서 그 방식으로 해보았다! WarriorController using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; public class WarriorController : MonoBehaviour { private Animator anim; private new Transform transform; private Vector3 moveDir; private void Start() { this.anim = this.GetComponent(); this.transform = this.GetCompo.. 2023. 8. 31.
23/08/30 HeroShooter 타이틀 (비동기 씬 전환) **비동기로 씬을 로딩하는 이유 : 동기로 씬을 가져올 경우 한 장면에 있는 모든 정보들을 불러오기 때문에 시간이 길어져서 사용자에게 불쾌한 경험을 줄 수 있음. 따라서 비동기적인 방법으로 씬을 로드함 App (App씬) using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class App : MonoBehaviour { private void Awake() { DontDestroyOnLoad(this.gameObject); } void Start() { //비동기 씬로드 AsyncOperation oper = SceneManager.Load.. 2023. 8. 30.
23/08/29 TestAreaMask TestMonster using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; using UnityEngine.AI; public class TestMonster : MonoBehaviour { [SerializeField] private Transform target; private NavMeshAgent agent; private Animator anim; void Start() { this.agent = this.GetComponent(); this.anim = this.GetComponent(); //코루틴 실행 this.StartCoroutine(this.CoD.. 2023. 8. 29.
23/08/27 [주말과제] HeroShooter Stage1 미완 Player using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; public class Player : MonoBehaviour { private Transform playerTrans; public float moveSpeed = 5f; private Animator anim; public float turnSpeed = 80f; private Rigidbody rBody; [SerializeField] private float radius = 1.0f; [SerializeField] private float rayOffsetY = 0.5f; //Ray 오프셋 [SerializeF.. 2023. 8. 27.
23/08/24 HeroShooter 사정거리 안에 몬스터 감지 사정거리 안에 가장 가까운 몬스터 인지 - layer 설정하기 - collider 없으면 게임오브젝트에 달아주기 - collider 배열 만들기 - monster collider들 검색하기 - 순회하면서 player collider와 monster collider 사이 거리 측정 - 둘 사이의 거리 어딘가에 저장 (사전 등..) - 가장 가까운 오브젝트 구하기 - 둘 사이의 방향 구하기 - 해당 게임오브젝트에게 ray 쏘기 2023. 8. 24.