|
-
interesting question!
i like the bit mask approach. perhaps paired with some sort of command-ish structure where the execute method gets passed Object X and Object Y.
Code:
public interface ICommand
{
function execute( obj1:GameObject, obj2:GameObject ) : void;
}
each on bit index maps to either an instance of an ICommand implementer or the implementing class itself. that should keep your code modular and abstracted from whatever deems the objects as interacting, and which interaction commands are applicable to an object. You can then find the right mix of obj type checking vs. number of ICommands to suit your style.
if you end up with more than 32 interaction commands, you can use a bit vector instead of an integer. i just wrote a post on my blog with source about bit vectors here: http://blog.generalrelativity.org/ac...d-bit-vectors/
Last edited by newblack; 05-14-2009 at 05:08 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|