You could set up a script that holds a static variable that keeps track of the score. Then you call some functions that add or subtract the score.
// The score variable
static var playerScore : int;
// The amount variable to add or subtract score
var newPoints : int = 10;
function Start () {
// Set score at ZERO to start
playerScore = 0;
}
// ----- Call one of these functions when you destroy your enemies -----
function AddToScore () {
playerScore = playerScore + newPoints;
}
function SubtractFromScore () {
playerScore = playerScore - newPoints;
}
↧