- Home /
Weapon Switch
I can't imagine a system to switch between weapons, when i has the first and the second weapon, it was easy, i was using:
if(currentWeapon = "M9") {
M9.Active = true;
M4A1.Active = false;
}
else if(currentWeapon = "M4A1") {
M9.Active = false;
M4A1.Active = true;
}
but now i have more than two weapons, and i want the primary and the secondary weapon and if i use that script for 20 weapons for e.g the script would have 9123123 lines of code, exist a simply way to do that? i dont want code i want explaination, using csharp. someone?
Answer by eddyzy · Sep 04, 2013 at 01:50 PM
you could make a gun controller script, store your guns into an array,use a variable to store the current gun and just switch between them when you press the respective button.
just an ideea.
Your answer
Follow this Question
Related Questions
weapon switching 1 Answer
gun switch script 26-feb-2010 1 Answer
Weapon pick up and switching script 2 Answers
Unfixable Assets/Scripts/PlayerAttack.cs(30,15): error CS1525: Unexpected symbol `private' 1 Answer
Weapon Switching 1 Answer