init
This commit is contained in:
commit
862afc9b7a
478 changed files with 197737 additions and 0 deletions
27
Assets/Scripts/Dropper.cs
Normal file
27
Assets/Scripts/Dropper.cs
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue