27 lines
665 B
C#
27 lines
665 B
C#
|
|
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);
|
|
}
|
|
|
|
}
|
|
}
|