Graphics Reference
In-Depth Information
// this may be a little over-the-top, but hard coding it
// just wouldn't fit in with the overall theme of re-use
for(int i=0; i<totalPlayers; i++)
{
tempQuat= Quaternion.identity;
if(i==0)
{
// place player 1 at the default start
// position of -5,0,0
tempVec3= new Vector3( -5, 0, 0 );
} else {
// we'll make player 2 a start position 5
// units to the right of the start position
// of player 1
tempVec3= new Vector3( -5 + (i*5), 0, 0 );
}
playerStarts[i]=tempVec3;
playerRotations[i]=tempQuat;
}
// if we haven't already got players set up, didInit will
// still be false... otherwise we skip creating the players
if(!didInit)
SpawnController.Instance.SetUpPlayers
( playerPrefabList, playerStarts, playerRotations,
playerParent, totalPlayers );
// grab a ref to the player's gameobject for later use
playerGO1= SpawnController.Instance.GetPlayerGO( 0 );
// if we have a two-player game, let's grab that second
// player's gameobject too
if( totalPlayers>1 )
playerGO2= SpawnController.Instance.GetPlayerGO( 1 );
// find the game camera
CameraTransform = GameObject.Find("GameCamera").transform;
// position the camera at the specified start position
// (set in the Unity editor Inspector window on this
// component)
tempVec3 = CameraTransform.localPosition;
tempVec3.z = CameraStartPositionZ;
CameraTransform.localPosition = tempVec3;
// if we don't have a camera control script object set by
// the editor, try to find one
cameraControl= CameraTransform.GetComponent<BaseCameraController>();
isStopped=false;
// make sure we have a scene manager to talk to
GetSceneManager ();
didInit=true;
}
Search WWH ::




Custom Search