일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- SQL
- DP
- 스토어드 프로시저
- two pointer
- Stored Procedure
- 다익스트라
- 그래프
- MYSQL
- binary search
- Trie
- Dijkstra
- Two Points
- String
- Hash
- union find
- Brute Force
- 이진탐색
- Today
- Total
목록전체 글 (425)
codingfarm

데미지를 입는 오브젝트가 있다고 하자. 이 오브젝트에 총알이 닿으면, 충돌체의 종류에 알맞은 이벤트가 발생할것이다. 생명체의 경우엔 데미지를 입은 후, HP가 바닥너면 죽어서 사라질것이다. 장애물은 파괴되어 산산이 흩어질것이다. 게이트라면 문이 열릴것이다. 그리고 각 오브젝트는 자신들이 총알에 닿았을때 발동시킬 함수를 다 가지고 있다. 총알은 자신과 닿은 오브젝트의 종류를 파악한 후, switch 문으로 분기점을 형성하여 각기 다른 함수를 호출해도 된다. 하지만 총알은 자신이 닿은 오브젝트가 무엇인지 신경 쓰지 않고 그냥 파괴 효과를 주는것이 더 효율 적일것이다. 이런 경우, 상속이 매우 유용히 쓰일 수 있다. 총알의 경우 충돌이 발생했을 때, 상대방에게 IDamageable 컴포넌트가 있는지만 조사하여..
쿨타임 1 2 3 4 5 6 7 8 float msBetweenFire, nextTime; public void Fire() { if(Time.time > nextTime){ nextTime = Time.time + msBetweenFire / 1000; /* functions */ } } Colored by Color Scripter cs
1 2 3 4 5 6 public Unit unit; public Transform spawner; public void Spawn(){ Unit newUnit = Instantiate(unit, spawner.position, spawner.rotation) as Unit; } Colored by Color Scripter cs
트랜스 폼 1 2 3 4 5 6 7 8 9 10 Vector3 velocity; public void Move(Vector3 _velocity) { velocity = _velocity; } public void Update() { transform.Translate(velocity * Time.deltaTime); } Colored by Color Scripter cs 물리엔진 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Vector3 velocity; Rigidbody myRigidbody; void Start() { myRigidbody = GetComponent (); } public void Move(Vector3 _velocity) { velocity = _velocity; } ..