Graphics Reference
In-Depth Information
public void FinishedLevel ()
{
// make sure we have a scene manager to talk to
GetSceneManager ();
// tell scene manager to load the next level
if( sceneManager != null )
{
sceneManager.GoNextLevel();
} else {
Debug.LogError("SCENE MANAGER DOES NOT EXIST. CAN'T
MOVE TO NEXT LEVEL!");
}
}
void GetSceneManager ()
{
// find level loader object
GameObject sceneManagerGO = GameObject.Find ( "SceneManager" );
// check to see if we managed to find a manager object
// before trying to get at its script
if( sceneManagerGO!=null )
sceneManager=
sceneManagerGO.GetComponent<SceneManager>();
}
public override void EnemyDestroyed ( Vector3 aPosition,
int pointsValue, int hitByID )
{
// tell our sound controller to play an explosion sound
BaseSoundController.Instance.PlaySoundByIndex( 1,
aPosition );
// play an explosion effect at the enemy position
Explode ( aPosition );
if(hitByID==1)
{
// tell main data manager to add score
mainPlayerDataManager1.AddScore( pointsValue );
// update the score on the UI
UpdateScoreP1( mainPlayerDataManager1.GetScore() );
} else {
// tell main data manager to add score
mainPlayerDataManager2.AddScore( pointsValue );
// update the score on the UI
UpdateScoreP2( mainPlayerDataManager2.GetScore() );
}
// count how many have been destroyed and if necessary spawn
// a powerup here instead
powerupExplosionCounter++;
if( powerupExplosionCounter>numberOfExplosionsToMakePowerup )
Search WWH ::




Custom Search