유니티 기초 40

챕터6 고양이 점프[점프막기, 카메라 아래 최소치 정하기 미완]

CatController using System.Collections; using System.Collections.Generic; using UnityEditor.U2D.Animation; using UnityEngine; using UnityEngine.SceneManagement; public class CatController : MonoBehaviour { private Rigidbody2D rBody2D; public float jumpForce = 10f; // 점프하는 힘 private float moveForce = 30f; //이동하는 힘 private Animator anim; // Start is called before the first frame update void Start(..

유니티 기초 2023.08.02

챕터5 고양이탈출 - Prefab

화면가두기 https://ruen346.tistory.com/124 유니티(Unity) 캐릭터 범위내 이동 - Mathf.Clamp 유니티에서 캐릭터를 Translate를 이용하여 움직이게 될때 특정 범위안에서만 이동하고 싶을때가 있다. 이럴때에는 Mathf.Clamp 함수를 사용하면 된다. character.transform.Translate(Time.deltaTime, 0, 0); 기존에 ruen346.tistory.com GameDirector using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GameDirector : MonoBehaviour {..

유니티 기초 2023.08.02

챕터5 고양이탈출 - CatEscape - 복습

Gizmo 사용법 - Radius를 수정하면 빨간원이 줄었다 커졌다 한다. ArrowController using System.Collections; using System.Collections.Generic; using UnityEngine; public class ArrowController : MonoBehaviour { public float speed; private GameObject catGo; // Start is called before the first frame update void Start() { this.catGo = GameObject.Find("cat"); } private bool IsCollide() { //두 원사이의 거리 var dis = Vector3.Distance..

챕터5 고양이탈출

ArrowController using System.Collections; using System.Collections.Generic; using UnityEngine; public class ArrowController : MonoBehaviour { [SerializeField] //SerializeField 애트리뷰트를 사용하면 private 멤버도 인스펙터에 노출 //,, 다른 점 -> 인스턴스에 접근 불가 ,, 혼선 막기 private float speed; private GameObject catGo; // Start is called before the first frame update void Start() { this.catGo = GameObject.Find("cat"); Debug.L..

유니티 기초 2023.08.01

자동차 스와이프 SwipeCar

오캠 - 움짤도 있음 그림 파일 - using System.Collections; using System.Collections.Generic; using UnityEngine; public class CarController : MonoBehaviour { public int rotAngle = 0; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { //마우스 왼쪽 버튼을 눌렀다면 if(Input.GetMouseButtonDown(0)) { Debug.Log("왼쪽 버튼 클릭"); //원점으로 게임오브젝트를 이동하자 Debug.Log(this); ..

유니티 기초 2023.08.01

유니티

라이프사이클 기술면접에서 가끔 나옴 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Cube : MonoBehaviour { // Start is called before the first frame update void Start() { Debug.Log(this); //cube클래스의 인스턴스 Debug.Log(this.gameObject); //cube클래스의 인스턴스 ( 컴포넌트가 붙어있는 게임오브젝트 인스턴스) //내가 붙어있는 게임오브젝트의 특정 컴포넌트 인스턴스를 가져올 수 있음 } // Update is called once per frame void Update() { } ..

유니티 기초 2023.07.31