<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.xna.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>http://forums.xna.com/forums/32.aspx</link><description>Don't know where to post your question? Post it here!</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 0.0)</generator><item><title>Re: how can i pass info between 2 classes/game components</title><link>http://forums.xna.com/forums/thread/94145.aspx</link><pubDate>Tue, 30 Sep 2008 19:56:11 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:94145</guid><dc:creator>Meme83</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/94145.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=94145</wfw:commentRss><description>&lt;p&gt;I guess that you don&amp;#39;t want the two components to know about each other.&amp;nbsp;&lt;/p&gt;
I suggest you to have an other class (let&amp;#39;s call it glue) with references to both the quest and the item managers. This class will be observer of the quest manager (google for the observer pattern *), and will be responsible to call the required method of the item manager.
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;* If you look &lt;a href="http://en.wikipedia.org/wiki/Observer_pattern" target="_blank" title="http://en.wikipedia.org/wiki/Observer_pattern"&gt;here&lt;/a&gt; you see a C# example using the events.&lt;/p&gt;
&lt;p&gt;In your case you first define a QuestCompletedEvent and add a field of that type in the Quest class. Then you subscribe the Glue class to it, by creating a method OnQuestCompleted which takes the senter and the arguments (as shown in the example) and subscribing that method with the += operator (see example). Secondly, inside the logic of the Quest class you add
a .Notify() when the quest is completed, this way the glue Class gets
notified, i.e. the OnQuestCompleted method is called. Inside that method you will run the code necessary to update the item manager.&lt;/p&gt;
&lt;p&gt;I hope this clarifies the thing. The only thing you need then is to find a proper name for the Glue class ;)&lt;/p&gt;</description></item><item><title>Re: how can i pass info between 2 classes/game components</title><link>http://forums.xna.com/forums/thread/94140.aspx</link><pubDate>Tue, 30 Sep 2008 19:28:05 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:94140</guid><dc:creator>RenegadeGD</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/94140.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=94140</wfw:commentRss><description>&lt;p&gt;Thanks for the reply!&lt;/p&gt;
&lt;p&gt;i should have known to do it globally.&lt;/p&gt;
&lt;p&gt;and thanks for the other method, its always good to learn new things.&lt;/p&gt;</description></item><item><title>Re: how can i pass info between 2 classes/game components</title><link>http://forums.xna.com/forums/thread/94128.aspx</link><pubDate>Tue, 30 Sep 2008 18:53:13 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:94128</guid><dc:creator>jwatte</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/94128.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=94128</wfw:commentRss><description>The easiest way: make your item manager a global. This works as long as there is only ever one item manager.
&lt;p&gt;The harder way: define interfaces, and ask for them. Define an IMoneyManager interface:&lt;/p&gt;
&lt;p&gt;public interface IMoneyManager {&lt;br /&gt;
&amp;nbsp; int Balance { get; }&lt;br /&gt;
&amp;nbsp; void ChangeBalance(int delta);&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;Implement this in your Player class. Whenever something interacts with a quest, pass in the object that is interacting. The quest can then try to cast the object as IMoneyManager (obj as IMoneyManager), and if it&amp;#39;s not NULL, interact with the interface.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;br /&gt;</description></item><item><title>how can i pass info between 2 classes/game components</title><link>http://forums.xna.com/forums/thread/94115.aspx</link><pubDate>Tue, 30 Sep 2008 18:21:02 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:94115</guid><dc:creator>RenegadeGD</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/94115.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=32&amp;PostID=94115</wfw:commentRss><description>&lt;p&gt;ok, I’m going to try explain this clearly, but let me know if I’m not.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Ok, so i have a class called &amp;quot;active scene&amp;quot; this is shown when you’re playing the game (e.g. moving the character around). within this class I have 2 game components iv made, 1. Quest manager 2. Item manager.&lt;/p&gt;
&lt;p&gt;What I want to know is how do I get info from the quest component to the item component.&lt;/p&gt;
&lt;p&gt;So when a quest&amp;nbsp;equals complete in my quest manager I want to add a set amount of money to the money variable in my item manager.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;thanks in advance&lt;/p&gt;</description></item></channel></rss>