목록program()/Unity (2)
DINO NET
QuitButton.cs using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class QuitButton : MonoBehaviour { // Start is called before the first frame update void Start() { Button button = GetComponent(); button.onClick.AddListener(ExitGame); } void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { ExitGame(); } } public void ExitGame() { #if UNIT..
FPS 게임 만들 때 사용했었던 코드 1. player의 움직임 구현 (PlayerMove.cs) - 키보드의 입력 값을 받아 player 움직임 - 점프 space로 구현 (중력 계산) 2. 카메라 조정 (PlayerRotate.cs, CamFollow.cs, CamRotate.cs) - camera가 player에 붙는 1인칭. 마우스로 시선을 따라가는 느낌. - camera가 수직으로 넘어가지 않게 상하 제한 두기 (y축 회전 제한) - 회전은 Quatation! 3. 공격 및 체력 시스템 (PlayerFire.cs, EnemyFSM.cs) - 마우스로 클릭 -> ray로 mass 감지(건물 및 적에게 rigidbody가 존재해야함) -> 부딪힌 rigidbody에 이펙트 효과(총알이 맞는 효과) ..