This commit is contained in:
Gerard Gascón 2025-04-24 16:56:52 +02:00
commit 862afc9b7a
478 changed files with 197737 additions and 0 deletions

29
Assets/Scripts/Ammo.cs Normal file
View file

@ -0,0 +1,29 @@
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<SpriteRenderer>();
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<PlayerWeaponController>().currentBullets += amount;
Destroy(gameObject);
}
}
}