User Tools

Site Tools


proton_entity_part2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
proton_entity_part2 [2010/10/27 14:29]
seth
proton_entity_part2 [2012/02/07 09:45]
aki [What's the Proton way to do it?]
Line 4: Line 4:
 The answer may surprise you... we'll use an extremely simple example to contrast the "old way" with the "new way". The answer may surprise you... we'll use an extremely simple example to contrast the "old way" with the "new way".
  
-Traditionally in an entity system, you may have said I want to be able to fade out my entity by doing a simple **Entity::​FadeOut(int fadeTimeMS);​** Or possibly a more fancy **Entity::​FadeOut(int fadeTimeMS, int delayBeforeStartingFadeMS);​**+Traditionally in an entity system, you may have said //"Hey mom, I want to be able to fade out my entity by doing a simple **Entity::​FadeOut(int fadeTimeMS);​** Or possibly a more fancy **Entity::​FadeOut(int fadeTimeMS, int delayBeforeStartingFadeMS);​**"//
  
 And you'd need to add a timer to keep track of the fade which would manipulate the alpha component when rendering. ​ You may end up writing it more than once for different entity types. ​ You might end up with every entity in the game having this fade timer that most of them don't use. And you'd need to add a timer to keep track of the fade which would manipulate the alpha component when rendering. ​ You may end up writing it more than once for different entity types. ​ You might end up with every entity in the game having this fade timer that most of them don't use.
Line 10: Line 10:
 ====What'​s the Proton way to do it?==== ====What'​s the Proton way to do it?====
  
-You may say, "//well, that's ok, I'll write a FadeOutComponent//"​. ​ No, my good sir, that would be overkill. ​ Simply modifying values over time doesn'​t need a custom component.+You"//​I'​ll ​just write a FadeOutComponent//"​. ​ No, my good sir, that would be overkill. ​ Simply modifying values over time doesn'​t need a custom component.
  
-First, here is a brute force dumb way it could be done by overusing the message ​message manager: (but notice it does save us from needing to add any code inside the entity or any component classes, we want to keep them as pure as fresh snow)+First, here is a brute force dumb way it could be done by overusing the message manager: (but notice it does save us from needing to add any code inside the entity or any component classes, we want to keep them as pure as fresh snow)
  
 <code cpp> <code cpp>
proton_entity_part2.txt ยท Last modified: 2012/02/07 09:45 by aki