using System.Collections; using System.Collections.Generic; using UnityEngine; public class BombUse : MonoBehaviour { public Character character; public Inventory inven; [Space(10)] public Bomb prefabBomb; Bundle bundle = new Bundle(); void Update() { if (Input.GetKeyDown(KeyCode.E) && inven.ItemUse("Bomb", 1)) { GameObject obj = character.map.ObjectCreate(prefabBomb.gameObject, null, Vector3.one, transform.position); Bomb bomb = bundle.Get(obj.name); if(bomb == null) { bomb = obj.GetComponent(); bundle.Add(bomb.name, bomb); } bomb.OnInitialized(character, LayerMask.NameToLayer($"HitAll")); } } }