In working at a musical game and trying to make a system where when you reach certain conditions,a set of instructions are loaded and change somes rules (background scrooling speed,background material,points value,etc.)
Example :
Level 1
Level 2
Level 3
Level 4
Start in Level 2
Variable A Start with Value = 5
Do someting right A+1
Do someting wrong A-1
if A=10
next level
reset A value to 5
if A=0
previous level
reset A value to 5
Every level is a set of istructions to change the game rules in real time
Level 1 points worth 1
Level 2 points worth 2
etc.
1 Answer
1
Try doing something like this-
class LevelInfo
{
public float difficulty;
public string levelName
// etc.
}
Now, in your level-manager component, make a bunch of these:
// make these an array if that architecture would work better for you
public LevelInfo levelOne;
public LevelInfo levelTwo;
public LevelInfo levelThree;
private int skillRank;
private LevelInfo currentLevel;
void Start()
{
currentLevel = levelOne;
}
void Update()
{
if(skillRank < 5)
{
currentLevel = levelOne;
} else if(skillRank < 10)
{
currentLevel = levelTwo;
} else
{
currentLevel = levelThree;
}
}
Then, whenever you need to get information about the current difficulty level, just use
currentLevel.difficulty; //(or whatever)
thanks man!!
– MetalLord