Thread: Actor keys help
View Single Post
  #2  
Old 03-20-2012, 06:44 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Aha you add the keys of a empty dictonary to a list and wondering why no members is in there?

Code:
    private Dictionary<String, AiActor> allActors = new Dictionary<String, AiActor>();

    public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);

        allActors.Add(shortName, actor); //<=== Added to feed the dictionary

        #region actor keys testing
        List<string> keys = new List<string>(allActors.Keys);
        sendChatMessageTo(-1, "Keys count=" + keys.Count.ToString(), null);
        #endregion
    }

Last edited by FG28_Kodiak; 03-20-2012 at 06:50 AM.
Reply With Quote