Graphics Reference
In-Depth Information
// make sure that there are enough start positions for the number
// of players
for ( int i = 0; i < numberOfPlayers; i++ )
{
// grab position and rotation values from start position
// transforms set in the inspector
playerStarts [i] = (Vector3) startPoints [i].position;
playerRotations [i] = ( Quaternion ) startPoints [i].rotation;
}
SpawnController.Instance.SetUpPlayers( playerPrefabList,
playerStarts, playerRotations, playerParent, numberOfPlayers );
playerTransforms=new ArrayList();
// now let's grab references to each player's controller
// script
playerTransforms =
SpawnController.Instance.GetAllSpawnedTransforms();
playerList=new ArrayList();
for ( int i = 0; i < numberOfPlayers; i++ )
{
Transform tempT= (Transform)playerTransforms[i];
Player_LBS tempController=
tempT.GetComponent<Player_LBS>();
playerList.Add(tempController);
tempController.Init ();
}
// grab a ref to the player's gameobject for later
playerGO1 = SpawnController.Instance.GetPlayerGO( 0 );
// grab a reference to the focussed player's controller script, so
// that we can do things like access its speed variable
thePlayerScript = ( Player_LBS )
playerGO1.GetComponent<Player_LBS>();
// assign this player the id of 0
thePlayerScript.SetID( 0 );
// set player control
thePlayerScript.SetUserInput( true );
// as this is the user, we want to focus on this for UI etc.
focusPlayerScript = thePlayerScript;
// see if we have a camera target object to look at
Transform aTarget=
playerGO1.transform.FindChild("CamTarget");
if(aTarget!=null)
{
// if we have a camera target to aim for, instead of
// the main player, we use that instead
Search WWH ::




Custom Search