Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class AmmoSpawn : MonoBehaviour {
- public GameObject AmmoBox;
- Vector3 center;
- Vector3 size;
- // Use this for initialization
- void Start () {
- spawnAmmoBoxes();
- }
- // Update is called once per frame
- void spawnAmmoBoxes () {
- Vector3 pos = center + new Vector3(Random.Range(-size.x / 0.5f, size.x / 0.5f), 0, Random.Range(-size.z/ 0.5f , size.z / 0.5f));
- for (int i = 0; i < 10; i++)
- {
- GameObject.Instantiate(AmmoBox, pos, Quaternion.identity);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement