dev:abstract_elements
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| dev:abstract_elements [2014/09/23 19:10] – tsmall1 | dev:abstract_elements [2014/09/23 19:35] (current) – [Create abstract class] tsmall1 | ||
|---|---|---|---|
| Line 19: | Line 19: | ||
| We should also not define '' | We should also not define '' | ||
| + | |||
| + | We also cannot define **THE_INSTANCE**, | ||
| We need a behavior method which wanders the same for all children. This looks like: | We need a behavior method which wanders the same for all children. This looks like: | ||
| Line 29: | Line 31: | ||
| MDist< | MDist< | ||
| Dir d = (Dir)rand.Create(Dirs:: | Dir d = (Dir)rand.Create(Dirs:: | ||
| - | u32 maxWanderDist = Dirs:: | ||
| - | | ||
| - | maxWanderDist = MAX(GetWanderDistance(), | ||
| - | Dirs::FillPoint(wanderPt, d); | + | Dirs::FillDir(wanderPt, d); |
| - | wanderPt *= maxWanderDist; | + | wanderPt *= Dirs:: |
| - | if(window.GetRelativeAtom(wanderPt).GetType() == | + | if(window.IsLiveSite(wanderPt)) |
| - | | + | |
| { | { | ||
| - | window.SwapAtoms(wanderPt, | + | |
| + | | ||
| + | { | ||
| + | window.SwapAtoms(wanderPt, | ||
| + | } | ||
| + | } | ||
| } | } | ||
| } | } | ||
| Line 54: | Line 57: | ||
| Next, we need some child classes to inherit from this one. We will create two classes, which are nearly identical, to do this. | Next, we need some child classes to inherit from this one. We will create two classes, which are nearly identical, to do this. | ||
| - | First, each of these classes gets an '' | + | First, each of these classes gets an '' |
| - | Next, change the class definition and the constructor to use '' | + | Next, change the class definition and the constructor to use '' |
| + | |||
| + | Next, define '' | ||
| + | |||
| + | Finally, define '' | ||
| + | |||
| + | < | ||
| + | protected: | ||
| + | | ||
| + | { | ||
| + | return (u32)m_wanderDistance.GetValue(); | ||
| + | } | ||
| + | </ | ||
dev/abstract_elements.1411499434.txt.gz · Last modified: 2014/09/23 19:10 by tsmall1
