How would a simple NPC be done in StrangeIoC?

92 views
Skip to first unread message

Dan Huffman

unread,
May 2, 2015, 10:14:56 PM5/2/15
to stran...@googlegroups.com
Say I have an NPC. That NPC has it's own animations and actions (AI). In Unity's way of doing things. Animations and AI would be components on each instance of the NPC. In the StrangeIoC world that NPC instance is considered a View because it is a GameObject and is a Monobehavior. How would this NPC be broken down to fulfill the StrangeIoC way? Would all the components, both Unity provided (animation), and from the Asset Store (like RAIN AI) which are designed to be components on GameObjects, have to be wrapped in a class to decouple them from the View (GameObject)?

wcorwin

unread,
May 4, 2015, 2:59:29 PM5/4/15
to stran...@googlegroups.com
It sounds like you want one View class that references the animation and ai components within it. Mediate that View and communicate between the NPC and the rest of the app. You don't want to decouple the view from the animation. From the AI, probably. But I have no idea how that code is written. An NPC is a huge concept, so avoid building a monolithic view that is holding tons of state and becomes an enormous class. 

Dan Huffman

unread,
May 4, 2015, 7:00:31 PM5/4/15
to stran...@googlegroups.com
Thanks. That clears it up. Looking at the StrangeRocks example I couldn't find any prefabs with the number of components that one finds in usual Unity games. The only thing I could find was the missle_explosion which contained another GameObject that is a particle system. So all the GameObjects (I guess views) are very light.

Dan Huffman

unread,
May 4, 2015, 8:05:13 PM5/4/15
to stran...@googlegroups.com
Looking at the StrangeRocks example again I found a case of injection with no corresponding bind....

In some views, RockView.cs for one, is the following:

        [Inject]
        public IScreenUtil screenUtil{get;set;}

But when I search the solution for IScreenUtil or ScreenUtil, i can't find any corresponding .Bind< IScreenUtil>()

So in RockView.cs where is the injected instance of IScreenUtil/ScreenUtil coming from?

wcorwin

unread,
May 6, 2015, 2:08:00 PM5/6/15
to stran...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages