Graphics Reference
In-Depth Information
// set up the data for our player
myDataManager= myPlayerManager.DataManager;
myDataManager.SetName("Player");
myDataManager.SetHealth(3);
isFinished= false;
// tell game control to update the lives UI
GameController_LBS.Instance.UpdateLivesP1(myDataManager.GetHealth());
}
public override void GetInput()
{
if(isFinished || isRespawning)
{
horz=0;
vert=0;
return;
}
// drop out if we're not supposed to be controlling this player
if(!canControl)
return;
// grab inputs from the default input provider
horz= Mathf.Clamp( default_input.GetHorizontal() , -1, 1 );
vert= Mathf.Clamp( default_input.GetVertical() , -1, 1 );
// fire if we need to
if( default_input.GetFire() && canFire )
{
// tell weapon controller to deal with firing
weaponControl.Fire();
}
}
public void GameStart()
{
// this function is called by the game controller to tell us
// when we can start moving
canControl=true;
}
void LostLife()
{
isRespawning=true;
// blow us up!
GameController_LBS.Instance.PlayerHit( myTransform );
// reduce lives by one
myDataManager.ReduceHealth(1);
GameController_LBS.Instance.UpdateLivesP1( myDataManager.GetHealth() );
if(myDataManager.GetHealth()<1) // <- game over
{
Search WWH ::




Custom Search