so i want my weapons (game objects to switch ) acording to current weapon i have
so my current script is this
public WeaponObject [] Weapons ; /* this is the scriptable object i use for counting damge so i want to have my guns Game object mesh to change acordingly to this lets say if weapons[currentweapon] =1 guns is also = 1 and that they would actualy change */
public int currentweapon = 0; // int for current weapon
public GameObject [] guns; // aray of Gameobjects
public Transform gunend; // were the prefab is Instantiate
/*other part of code is just
if (press lalalal )
{ Fire();
}
*/
void Fire()
{
Timer = 0f;
Rigidbody bullet;
bullet = Instantiate (bulletprefab, gunend.position, gunend.rotation) as Rigidbody;
bullet.AddForce (gunend.forward * 4000);
}
}
I assume each weapon will switch to another specific weapon when you press the weapon switch key/button. Do you want them to just cycle through like gun->rifle->machinegun->rpg->gun ? or do you want certain one to always switch to certain ones like gun->rifle rifle->gun machine->rpg rpg->gun and if you needed to pick a specific one there would be some other menu to actually select from a list?
Well at first you have a currentweapon 0 i made a shop a button tipe UI canvas that alows you purchase weapons in game the weapon you buy switches the number on weapons[currentweapon] curently from 0 to 3 in any order so i need the gameobject [ ] guns to match the current weapon and switch the active gameobject gun