Graphics Reference
In-Depth Information
{
LostLife();
}
}
void OnTriggerEnter(Collider other)
{
if( other.gameObject.layer==12 )
{
// tell our sound controller to play a powerup sound
BaseSoundController.Instance.PlaySoundByIndex( 3,
myTransform.position );
// hit a powerup trigger
Destroy ( other.gameObject );
// advance to the next weapon
weaponControl.NextWeaponSlot( false );
}
}
void LostLife()
{
isRespawning=true;
// blow us up!
GameController_IP.Instance.PlayerHit( myTransform );
// reduce lives by one
myDataManager.ReduceHealth(1);
// update UI lives
if( ownerID==1 )
{
// as our ID is 1, we must be player 1
GameController_IP.Instance.UpdateLivesP1( myDataManager.GetHealth() );
} else {
// as our ID is 2, we must be player 2
GameController_IP.Instance.UpdateLivesP2( myDataManager.GetHealth() );
}
if(myDataManager.GetHealth()<1) // <- game over
{
// hide ship body
theMeshGO.SetActive(false);
// disable and hide weapon
weaponControl.DisableCurrentWeapon();
// do anything we need to do at game finished
PlayerFinished();
} else {
// hide ship body
theMeshGO.SetActive(false);
Search WWH ::




Custom Search