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

27
Assets/Scripts/Dropper.cs Normal file
View file

@ -0,0 +1,27 @@

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Dropper : MonoBehaviour
{
public GameObject ammo;
public void drop(GameObject obj) {
GameObject go = Instantiate(obj);
go.transform.position = gameObject.transform.position;
go.AddComponent<GroundItem>();
go.GetComponent<GroundItem>().selfPrefab = obj;
go.GetComponent<GroundItem>().Radius = 5;
}
public void Ammo()
{
if (Random.value <= 0.5f)
{
Destroy(gameObject);
Instantiate(ammo, transform.position, Quaternion.identity);
}
}
}