I am looking for recommendations on a quick Javascript function that can help me summarize the points total for a level. I can add points from an item to the players total easy enough and other bits, the point I'm stuck on is summing the potential level total.
I have multiple objects in the scene with point values that vary from item to item. Can I access this through a single variable or do I need to assign the variable by item and then hardcode in the "object one points" + "object two points", blah, blah blah. It would certainly seem the former given a static variable add function, but it alludes me.
Adding for clarity: To that, it would seem Objects with point values might have a script attached to them with:
static var pointsAre : int = XXX;
Then my in my SceneManager/GameState JS:
private var totalPoints : int;
function Awake () {
totalPoints = pointsAre + pointsAre...; //ACK - but how do I simply sum their accumulated total from all Objects in the scene.
}
Can this be done with a single static variable call?
Jonathan