using System.Collections; using System.Collections.Generic; using UnityEngine; public class Ammo : MonoBehaviour { public int amount; public Sprite one, two, three; // Start is called before the first frame update void Start() { amount = Random.Range(1, 4); SpriteRenderer sr = GetComponent(); if (amount == 1) sr.sprite = one; else if (amount == 2) sr.sprite = two; else if (amount == 3) sr.sprite = three; } private void OnTriggerEnter2D(Collider2D collision) { if (collision.transform.tag.Equals("Player")) { collision.transform.GetComponent().currentBullets += amount; Destroy(gameObject); } } }