How do I make it so I can change players for the user to control. For instance so '1' selects tank, '2' selects helicopter? Similar to the character/player select system used in beat-em-ups/shmups.
I'd try having a manager object with references to all players/vehicles control scripts. Then if you press a certain button I'd activate one and deactivate all other vehicle's control script.
Try something like this: Create an empty game object called "PlayerInput" and attach the movement control script to it including the following...
// note... each character controller must have a camera defined
// that represents the viewpoint for that controller
var defaultController : int = 0;
var movementSpeed : double = 5.0;
var controllers : CharacterController[];
var cameras: Camera[];
private var currentCharacter;
private var currentController;
function Start()
{
currentCharacter = defaultController;
currentController = controllers[currentCharacter];
for( i = 0; i < cameras.length; i++ )
{
if( i == currentCharacter ) cameras*.enabled = true;*
_else cameras*.enabled = false;*_
_*}*_
_*}*_
_*function Update()*_
_*{*_
_*// player changing views...*_
_*if( Input.GetKeyDown( 'v' ) )*_
_*{*_
_*cameras[currentCharacter].enabled = false;*_
_*currentCharacter++;*_
_*if( currentCharacter == controllers.length )*_
_*currentCharacter = 0;*_
_*currentController = controllers[currentCharacter];*_
_*cameras[currentCharacter].enabled = true;*_
_*}*_
_*// movement for whichever character the player is currently controlling*_
_*// assumes Y is the up axis*_
_*var moveDirection = Vector3( Input.GetAxis ( "Horizontal" ), 0, Input.GetAxis ( "Vertical" ) );*_
<em>_currentController.Move( transform.TransformDirection( moveDirection ) * movementSpeed * Time.deltaTime );_</em>
_*}*_
_*```*_
_*<p>// EDIT: corrected a bug in the code example</p>*_