Super Knight : Enter the Dungeon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

29 lines
789 B

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<Bomb> bundle = new Bundle<Bomb>();
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<Bomb>();
bundle.Add(bomb.name, bomb);
}
bomb.OnInitialized(character, LayerMask.NameToLayer($"HitAll"));
}
}
}