我正在尝试在 C# + XNA 中制作一个简单的成就类,并且我想实现一个队列,以便当您快速获得多个成就时,后者将被添加到队列列表中。
这是为获得特定成就而调用的方法:
//This is the list that I want to add the achievements to be queued to
static List<Achievement> queueList;
public void GetAchievement()
{
//If the player hasn't got the achievement yet and another achievement is NOT being drawn, get the achievement
if (!got && !drawing)
get = true;
//If the player hasn't got the achievement yet and another achievement IS being drawn, add the achievement to the queue list
else if (!got && drawing)
queueList.Add(); //What do I do here?
}
所以这将被称为:exampleAchievement.GetAchievement(); exampleAchievement 是Achievement 类的对象。
我只是不知道如何知道哪个对象正在调用 GetAchievement(),所以我不知道要向 queueList 添加什么。
任何帮助将不胜感激!
~卢卡
编辑:我用过:
queueList.Add(this);
但我只是愚蠢并且没有正确测试它,所以看起来没有任何东西被添加到列表中。无论如何感谢您的帮助:3