//These two functions get and set stats from the GameController. They are used in campaign mode to transfer stats from level to level. public void receiveStats() { GameController.PlayerStats myStats = GameController.instance.campaignPlayer; if (myStats.health <= 0) { return; } currentLives = myStats.lives; HSP.currentHealth = myStats.health; speed = myStats.speed; bombs = myStats.bombs; power = myStats.power; powerBomb = myStats.nuke; remoteBomb = myStats.remote; ghost = myStats.ghost; }
//The only situation in which to do this is at the end of a level. public void sendStats() { GameController.PlayerStats myStats = new GameController.PlayerStats(); myStats.lives = currentLives; myStats.health = HSP.currentHealth; if (myStats.health <= 0) { myStats.health = 1; } myStats.speed = speed; myStats.bombs = bombs; myStats.power = power; myStats.nuke = powerBomb; myStats.remote = remoteBomb; myStats.ghost = ghost; GameController.instance.campaignPlayer = myStats; }