etc-posts/Unity :: C# 튜토리얼
[유니티C#][AR] 누르면 색변하는 차 만들기.1
버턴누르면 차색깔 바뀌게 만들기 - 차의 머티리얼을 가져옴- 차를 누르면 콜리젼이 발생하도록 콜리젼 엔터에 색을 변화시키는 함수를 작성 123456789101112131415161718192021222324252627282930313233343536 using System.Collections;using System.Collections.Generic;using UnityEngine.UI;using UnityEngine; public class CarColorChange : MonoBehaviour { //실제 에셋의 메터리얼을 가져오는 경우이다. public Material mat = null; // Use this for initialization void Start () { //에셋의 메터리얼을 바..
[유니티C#][기초] 17. 튜토리얼 SurvivalShooter 정리.6
ㅁ12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 2-6 EnemyHealthusing UnityEngine; public class EnemyHealth : MonoBehaviour{ public int startingHealth = 100; public int currentHealth; public float sinkSpeed = 2.5f; public int scoreValue = 10; public AudioClip deathClip; A..
[유니티C#][기초] 16. 튜토리얼 SurvivalShooter 정리.5
1234567891011121314151617181920212223242526272829303132 2-5 CameraFollowusing System.Collections;using System.Collections.Generic;using UnityEngine; public class CameraFollow : MonoBehaviour { public Transform target; // The position that that camera will be following. public float smoothing = 5f; // The speed with which the camera will be following. Vector3 offset; // The initial offset from th..
[유니티C#][기초] 15. 튜토리얼 SurvivalShooter 정리.4
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 2-4 PlayerShooting using UnityEngine; public class PlayerShooting : MonoBehaviour{ public int damagePerShot = 20; public float timeBetweenBullets = 0.15f; public float range = 100f; float timer; Ray shootRay = new Ray(); Rayca..
[유니티C#][기초] 14. 튜토리얼 SurvivalShooter 정리.3
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 2-3 PlayerHealthusing UnityEngine;//UI관련 사용하려면 반드시 usingusing UnityEngine.UI;using System.Collections;using UnityEngine.SceneManagement; public class PlayerHealth : MonoBehaviour{ public int startingHealth = 100; public int ..
[유니티C#][기초] 13. 튜토리얼 SurvivalShooter 정리.2
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 2-2 PlayerMovement using UnityEngine; public class PlayerMovement : MonoBehaviour{ public float speed = 6f; Vector3 movement; Animator anim; Rigidbody playerRigidbody; int floorMask; float camRayLength = 100f; void Awake() { floorMask = LayerMask.GetMask("Floor"); anim = GetComponent(); pl..
[유니티C#][기초] 12. 튜토리얼 SurvivalShooter 정리.1
2-1 개요 (1) 플레이어 움직임 설정하기 - 애니메이터- RigidBody-Capsule Collider-PlayerMovement.cs-플레이어 총쏘는거 구현하기 - 총 쏠 때 파티클 , line(2) 카메라 움직임 설정하기-CameraMovement.cs-Ray될 FloorMask Quad 두기(3) 적 프레팹 설정하기- 에니메이터 설정 Startsinking 호출됨 / - RigidBody 설정- SphereCollider설정 ( 총에 피격될 )- Capslue collider 설정( 다르면 체력이 깍임)-EnemyMovement + Nav Mesh Agent( 인공지능 이동 구현 )(4) UI 구현하기- 체력바- 맞으면 빨간색 화면 깜박
[유니티C#][기초] 11. 적에게 체력 부여하기
1234567891011121314151617181920212223242526272829303132using System.Collections;using System.Collections.Generic;using UnityEngine; public class EnemyHealth : MonoBehaviour{ public int maxHealth = 100; public int currentHealth; private ParticleSystem hitParticle; public void Awake() { currentHealth = maxHealth; hitParticle = GetComponentInChildren(); } public void TakeDamage(int damage, Vector3 ..