unity - 대칭함수을 활용한 공격 출처 : Sebastian Lague IEnumerator Attack() { currentState = State.Attacking; pathFinder.enabled = false; Vector3 originalPosition = transform.position; Vector3 attackPosition = target.position; float percent = 0; float attackSpeed = 3; while(percent 응용프로그램/유니티(Unity) 2016.11.16
Unity - 스폰 시스템 만들기 스폰시스템 만들기 출처 : Sebastian Lague LivingEntity에서 아래의 코드를 잘 삽입~ public event System.Action OnDeath; if (OnDeath != null) { OnDeath(); //죽을때마다. 이벤트가 들어감 } Spawner.cs using UnityEngine; using System.Collections; public class Spawner : MonoBehaviour { public Wave[] waves; public Enemy enemy; int enemiesRemainingToSpawn; int enemiesRemainingAlive; float nextSpawnTime; Wave currentWave; int currentWaveNu.. 응용프로그램/유니티(Unity) 2016.11.14
Unity - 데미지 시스템 데미지 시스템 출처 : Sebastian Lague 상속과 오버라이드 virtual, override base.start(); 변수의 접근제한 protected interface IDamageable.cs using UnityEngine; public interface IDamageable { void TakeHit(float damage, RaycastHit hit); } LivingEntity.cs using UnityEngine; using System.Collections; public class LivingEntity : MonoBehaviour, IDamageable { public float startingHealth; protected float health; protected bool d.. 응용프로그램/유니티(Unity) 2016.11.14
Unity - 충돌감지관련 충돌감지관련 출처 : Sebastian Lague의 동영상 강의 using UnityEngine; using System.Collections; public class Projectile : MonoBehaviour { public LayerMask collisionMask; float speed = 10; public void SetSpeed(float newSpeed) { speed = newSpeed; } void Update () { float moveDistance = speed * Time.deltaTime; CheckCollisioins(moveDistance); transform.Translate(Vector3.forward * Time.deltaTime * speed); } void Ch.. 응용프로그램/유니티(Unity) 2016.11.14
Unity - CapsuleCollider 사이의 거리알아보기. myCollisionRadus = GetComponent().radius; targetCollisionRadius = target.GetComponent().radius; 사용방법 dirTotarget = (target.position - transform.position).normalized; targetPosition = target.position - dirTotarget * (myCollisionRadus + targetCollisionRadius); 응용프로그램/유니티(Unity) 2016.11.13
유니티 DB 사용하기 유니티 DB관련 참고자료 SQLite 소개 http://www.csharpstudy.com/Practical/Prac-sqlite.aspx c#으로 SQLite 연결하기 http://answers.unity3d.com/questions/743400/database-sqlite-setup-for-unity.htmlhttp://nsinc.tistory.com/127 보조도구 http://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki 예제 http://forum.unity3d.com/threads/tutorial-how-to-integrate-sqlite-in-c.192282/ http://www.codeproject.com/Articles/6343/.. 응용프로그램/유니티(Unity) 2016.11.13
Unity - 3D게임만들기(Ray로 오브젝트 방향전환) Ray로 오브젝트 방향전환하기 오브젝트를 생성한뒤 소스코드를 붙이고 아래의 코드를 실행하면 됩니다. Player.cs using UnityEngine; using System.Collections; [RequireComponent (typeof(PlayerController))] public class Player : MonoBehaviour { public float moveSpeed = 5; Camera viewCamera; PlayerController controller; void Start () { controller = GetComponent(); viewCamera = Camera.main; } void Update () { Vector3 moveInput = new Vector3(Input.. 응용프로그램/유니티(Unity) 2016.10.02
Unity - 3D게임만들기(매테리얼 색 입히기) 메테리얼 색 입히기 GameObject -> 3D Object -> capsule Assets 화면 우클릭 -> Create -> Meterial 생성된 Meterial 캡슐에 드래그해서 적용 -> inspector에서 조절하기 마테리얼 간단한 설정 응용프로그램/유니티(Unity) 2016.10.02
Unity - 이동 및 회전 알면 좋은 소스 Input.GetAxis ("받아들일 행동") GetAxis의 이동을 부드럽게~ 받아들임 Input.GetAxisRaw ("받아들일 행동") GetAxis의 이동을 즉시 받아들임 transform.LookAt(point); point의 방향으로 바라본다. imgLoading.rectTransform.Rotate(new Vector3(0, 0, -2)); z방향으로 -2만큼 회전시킴. 회전참조 캐릭터 움직이는 예지 Player.cs using UnityEngine; using System.Collections; [RequireComponent (typeof (PlayerController))] public class Player : MonoBehaviour { public float mov.. 응용프로그램/유니티(Unity) 2016.10.02
Unity - 3D게임 공부자료 모음 3D게임 제작 공부자료 탑다운 슈팅게임 만들기(유투브 강좌자료) 3D게임 요약정리중.. 캐릭터의 이동메테리얼 색입히기(Ray로 오브젝트 방향전환 * 참조 글, 동영상 : https://www.youtube.com/watch?v=jdv8erC7ML8&index=2&list=PLFt_AvWsXl0ctd4dgE1F8g3uec4zKNRV0 아래는 글쓸때 편의상 사용중 응용프로그램/유니티(Unity) 2016.10.02