-
Parrying Sword #9 : [기획][프로그래밍] 폭탄 구현 중유니티 엔진/Parrying Sowrd 2023. 2. 17. 12:11
벽을 부수는 것도 재밌겠다 싶어서 폭탄을 만들어 보았습니다.
아직 폭발 이펙트는 만들어지지 않았으며, 폭발이 플레이어나 몬스터에게 대미지를 줄 지는 아직 고민 중입니다.
using System.Collections; using System.Collections.Generic; using UnityEngine; public class DemolishingBomb : MonoBehaviour { Collider2D[] colliders; Rigidbody2D rb; private void Awake() { rb = GetComponent<Rigidbody2D>(); Invoke("bomb", 3.0f); } public void addForce(float dir) { rb.AddForce(new Vector2(7000.0f * dir, 6000.0f)); } private void bomb() { colliders = Physics2D.OverlapCircleAll(transform.position, 5.0f); foreach( Collider2D collider in colliders ) { if( collider.tag == "Road" ) { Destroy(collider.gameObject); } } Destroy(this.transform.parent.gameObject); } }
DemolishingBomb 클래스입니다.
'유니티 엔진 > Parrying Sowrd' 카테고리의 다른 글
Parrying Sword #11 : [아트] 보스 몬스터 스탠딩 스프라이트 (0) 2023.02.23 Parrying Sword #10 : [아트][기획] 벽 잡기, 와이어 액션, 폭탄 스프라이트 / 플레이어 애니메이션 현황 (0) 2023.02.17 Parrying Sword #8 : [기획][프로그래밍] 와이어 액션 구현 (0) 2023.02.17 Parrying Sword #7 : [기획][프로그래밍] 벽 잡기 (등반) 구현 (0) 2023.02.17 Parrying Sword #6 : [기획] 플레이어 액션 구현 (0) 2022.11.21