W
Wayfarer
Guest
Edit: Nevermind, I think I'm overthinking this. It's probably better not to use undefined
Original Post
There are probably better terms to explain what I'm saying but basically I'm asking this...
1. Say you have various wall objects (all using the same wall parent)
2. Then you have a set of scripts called "grassFX" which contains "grassFX_createEvent" and "grassFX_drawEvent". The point of "grassFX" is to add grass only to walls that you would like to add grass to. So "grassFX" is like its own module (is module the right word?).
I'm aware you could do this by simply having a variable in the parent object like "grassFX_enabled" and then only activating those scripts when that is true. Well, this is what I'm doing currently. But then I had started to wonder if you could keep the "grassFX" module entirely independent to the wall object, and if you wanted to check if a wall was using "grassFX" you could simple check something like "if (wall.grassFX != undefined)". Are there any downsides to this approach?
Hopefully I've explained this clearly. I'm mainly asking this because I just want to check if there is anything that is inefficient or not recommended about this technique.
Original Post
There are probably better terms to explain what I'm saying but basically I'm asking this...
1. Say you have various wall objects (all using the same wall parent)
2. Then you have a set of scripts called "grassFX" which contains "grassFX_createEvent" and "grassFX_drawEvent". The point of "grassFX" is to add grass only to walls that you would like to add grass to. So "grassFX" is like its own module (is module the right word?).
I'm aware you could do this by simply having a variable in the parent object like "grassFX_enabled" and then only activating those scripts when that is true. Well, this is what I'm doing currently. But then I had started to wonder if you could keep the "grassFX" module entirely independent to the wall object, and if you wanted to check if a wall was using "grassFX" you could simple check something like "if (wall.grassFX != undefined)". Are there any downsides to this approach?
Hopefully I've explained this clearly. I'm mainly asking this because I just want to check if there is anything that is inefficient or not recommended about this technique.
Last edited: