JoltEffect's Profile
Reputation: 0
Apprentice
- Group:
- New Members
- Active Posts:
- 4 (0.03 per day)
- Joined:
- 06-January 13
- Profile Views:
- 159
- Last Active:
Mar 05 2013 03:20 AM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Adding an item to a list if it is not already in the list
Posted 21 Feb 2013
Thanks for the links, gonna run off now and read those.
I have possible found a combination, however it does'nt look clean code to me and im sure it could be done better.
bool noLevelRequired = true; public void Update(GameTime gameTime) { noLevelRequired = false; for (int i = 0; i < levelStack.Count; i++) { if (levelStack[i].LevelState == LEVELSTATE.PLAYING) { noLevelRequired = true; levelStack[i].Update(gameTime); Debug.WriteLine("Level Manager Update for level " + levelStack[i].LevelName); } else if (levelStack[i].LevelState == LEVELSTATE.CHANGE) { loadLevelName = levelStack[i].NextLevelName; levelStack[i].LevelState = LEVELSTATE.FINISHED; } } for (int i = 0; i < levelStack.Count; i++) { if (levelStack[i].LevelName == loadLevelName && levelStack[i].LevelState == LEVELSTATE.FINISHED) { levelStack[i].Init(); noLevelRequired = true; } } if (noLevelRequired == false) { level = new Level(loadLevelName, this.content); levelStack.Add(level); } }
How does this look like it seems to be working?
Cheers
Jolt -
In Topic: Adding an item to a list if it is not already in the list
Posted 21 Feb 2013
The issue with that process is the item will exist as every item is the same "level", its only the contents of each level that is different.
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
JoltEffect hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
JoltEffect has no profile comments yet. Why not say hello?