Advertisement
Guest User

Weapons Instantiation

a guest
Jul 28th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using WhateverYouWantButPreferablyTheUnityStuff
  2.  
  3. ...
  4.  
  5. // a set of all available weapons that you can borrow from a static class or something
  6. private GameObject weaponList = someClassToStoreAListOfWeapons.weapons;
  7.  
  8. // number of weapons you wanna have
  9. public int wCount = 5;
  10.  
  11. void Start() { // or whatever function the devs normally call before match starts
  12.     Stack weaponStack = new Stack();
  13.     for (int i = 0; i < wCount; i+=1) {
  14.         weaponStack.push(weaponList[Random.Range(0, weaponList.length - 1)]);
  15.     }
  16. }
  17.  
  18. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement