Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class AmmoSpawn : MonoBehaviour {
  6. public GameObject AmmoBox;
  7. Vector3 center;
  8. Vector3 size;
  9.  
  10.  
  11. // Use this for initialization
  12. void Start () {
  13. spawnAmmoBoxes();
  14.  
  15. }
  16.  
  17. // Update is called once per frame
  18. void spawnAmmoBoxes () {
  19. 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));
  20.  
  21. for (int i = 0; i < 10; i++)
  22. {
  23. GameObject.Instantiate(AmmoBox, pos, Quaternion.identity);
  24. }
  25.  
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement