using UnityEngine; public enum BlockDrop_BlockType { Normal, Indestructible, Berry } [RequireComponent(typeof(Rigidbody), typeof(BoxCollider))] public class BlockDrop_Block : MonoBehaviour { public BlockDrop_BlockType type = BlockDrop_BlockType.Normal; public int hitPoints = 1; private bool collectedBerry = false; public void Hit(int damage) { if (type == BlockDrop_BlockType.Indestructible) return; hitPoints -= damage; if (hitPoints <= 0) { if (type == BlockDrop_BlockType.Berry && !collectedBerry) { collectedBerry = true; BlockDrop_GameManager3D.Instance.AddBerryAmmo(1); } Destroy(gameObject); } } }