일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- apk
- 프리팹
- 패럴렉스
- 오브젝트 풀링
- CSharp #자료구조
- 일시정지
- Parallax
- Ainimation Blending
- Hpbar
- Prefabs
- Blend Type
- rigidbody
- rotation
- Vector3
- 스크롤링
- joystick
- Animation State Machine
- Transform
- raycast
- raycasting
- 2D슈팅게임
- 플레이어 이동
- Scrooling
- Object Pooling
- Hp바
- 플레이어 방향전환
- LayerMark
- 유니티
- Object Poling
- Unity
- Today
- Total
주녘공부일지
[ShootingGame] 6. 아이템과 필살기 구현하기 본문
0. 준비하기
- string 으로 타입을 저장하여 분류
- Rigidbody2D를 가져와 아이템을 * 1f의 속도로 떨어뜨림
- OnTriggerEnter2D로 BorderBullet 태그에 닿으면 객체를 파괴
- Boom Icon은 기본 셋팅 투명도 0
( 폭탄의 사용 가능 갯수를 투명도 0, 1로 나타내는 로직이기 때문 )
1. 충돌 로직
- Item 태그에 닿으면 실행할 로직을 추가 ( power, boom 은 최댓값에 도달하면 점수로 변환 )
- 예외처리 내용 : 아이템 중복 드롭 방지
- 적 기체 파괴 시 랜덤한 확률로 아이템 드롭하는 로직 추가
( Instantiate()로 생성 )
2. 필살기
- isBoomTime : 필살기 중복 사용 방지
- boomEffect (GameObject) 활성화 하고 1.5초 뒤에 비활성화
FindGameObjectsWithTag("태그이름")
- 태그이름의 태그를 가진 씬의 모든 오브젝트를 추출함 ( 다수 )
- 적 기체는 데미지를 주고, 총알은 무조건 파괴 ( for문으로 추출된 갯수만큼만 )
https://docs.unity3d.com/ScriptReference/GameObject.FindWithTag.html
Unity - Scripting API: GameObject.FindWithTag
Tags must be declared in the tag manager before using them. A UnityException is thrown if the tag does not exist or an empty string or null is passed as the tag. Note: This method returns the first GameObject it finds with the specified tag. If a scene con
docs.unity3d.com
+ FindGameObjectWithTag("태그이름")
- 태그이름의 태그를 가진 씬의 오브젝트를 추출함 ( 단일 )
https://github.com/godgjwnsgur7/ShootingGame
강의 출처
https://www.youtube.com/watch?v=RLbcov_aGfo&list=PLO-mt5Iu5TeYtWvM9eN-xnwRbyUAMWd3b&index=6
'GameEngine > Unity - Lecture' 카테고리의 다른 글
[ShootingGame] 8. 최적화의 기본, 오브젝트 풀링 (0) | 2022.02.01 |
---|---|
[ShootingGame] 7. 원근감있는 무한 배경 만들기 + 페럴렉스, 스크롤링 (0) | 2022.01.31 |
[ShootingGame] 5. UI 간단하게 완성하기 (0) | 2022.01.28 |
[ShootingGame] 4. 적 전투와 피격 이벤트 만들기 (0) | 2022.01.28 |
[ShootingGame] 3. 적 비행기 만들기 (0) | 2022.01.27 |