Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--------Weapon Manager---------//
- //--------Kevin Soares--------//
- //--------Outbreak-----------//
- var weapons : GameObject[];
- var selectedWeapon : int;
- function Update ()
- {
- SwitchUpdates();
- }
- function SelectWeapon (index : int) {
- for (var i : int=0 ;i<weapons.length; i++) {
- if (i != index){
- weapons[i].gameObject.SetActiveRecursively(false);
- }else{
- weapons[i].gameObject.SetActiveRecursively(true);
- }
- }
- }
- function SwitchUpdates()
- {
- //Gun
- if (Input.GetKeyDown("1") && weapons.length >= 1)
- {
- SelectWeapon(0);
- selectedWeapon = 0;
- }
- //Pistol
- else if (Input.GetKeyDown("2") && weapons.length >= 2)
- {
- SelectWeapon(1);
- selectedWeapon = 1;
- isPistol = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement