본문 바로가기

분류 전체보기183

23/08/05 유니티 기초 복습(Roulette, CarSwipe) 1. Roulette 마우스 클릭 (왼쪽버튼)으로 룰렛 회전 후 서서히 감속시켜 멈추게하기 using System.Collections; using System.Collections.Generic; using UnityEngine; public class RouletteController : MonoBehaviour { public float rotAngle = 0; //회전속도 public float dampingCoefficient = 0.96f; //감쇠계수 설정 // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if (Input.GetMou.. 2023. 8. 5.
23/08/04 유니티짱 대각선으로 이동 멈춤 없이 타겟까지 이동(애니메이션 효과 x) using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class UnitychanController : MonoBehaviour { public Transform target; private bool isMoveStart = false; void Start() { } void Update() { if(this.isMoveStart) { this.transform.Translate(this.transform.forward * 1f * Time.deltaTime,Space.World); } } public void MoveS.. 2023. 8. 4.
23/08/04 유니티짱 직선으로 움직이기 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class UnitychanController : MonoBehaviour { public Animator anim; float moveSpeed = 1; private bool isMove; // Start is called before the first frame update void Start() { this.anim = this.GetComponent(); //Debug.Log(this.transform.forward); //지역좌표의 앞방향 //Debug.Log(Vector3.forward); //월드좌표.. 2023. 8. 4.
23/08/03 애니메이션 방향 전환 및 점프 연습 using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class HeroController : MonoBehaviour { private Animator anim; public Rigidbody2D rBody2D; public float jumpForce; public float moveSpeed; private float moveForce = 1f; private bool isJump = false; // Start is called before the first frame update void Start() { this.anim = this.GetComponent(); this.. 2023. 8. 3.
23/08/02 키보드로 인풋 받아 이동하기 using System.Collections; using System.Collections.Generic; using UnityEngine; public class HeroController : MonoBehaviour { // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { //키보드 좌우 인풋을 받아 -1,0,1 출력 float h = Input.GetAxisRaw("Horizontal"); //-1,0,1 //h; 방향 의미하는 값 Debug.LogFormat("===>{0}", (int)h); //좌우반전 스케일의 X값을 -1로 한다. 이때 Y.. 2023. 8. 3.
23/08/01 [수업과제] 표창 던지기 using System.Collections; using System.Collections.Generic; using UnityEngine; public class ShurikenController : MonoBehaviour { float rotSpeed = 0; float moveSpeed = 0; float dampingCoeffcient = 0.96f; //감쇠계수 private Vector3 startPos; //down 했을때 위치 // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { //마우스 스와이프 //마우스 왼쪽 버튼을 눌렀다면 if.. 2023. 8. 1.