Example #1
0
            public ScopeDesc(string name, AIMood mood, FactionValue faction) : this(name, mood)
            {
                if (faction == null)
                {
                    faction = FactionEnumeration.GetInvalidUnsetFactionValue();
                }

                privateFactionValue = faction;
                FactionID           = privateFactionValue.Name;

                this.ScopeKind = ScopeKind.Faction;
            }
Example #2
0
            public ScopeDesc(string name, AIMood mood)
            {
                this.Name          = name;
                this.ScopeKind     = ScopeKind.Global;
                this.UnitRole      = UnitRole.Undefined;
                this.AIPersonality = AIPersonality.Undefined;
                this.AISkillID     = AISkillID.Undefined;
                this.Mood          = mood;

                privateFactionValue = FactionEnumeration.GetInvalidUnsetFactionValue();
                FactionID           = privateFactionValue.Name;
            }
        public BehaviorVariableValue GetVariableWithMood(string key, AIMood mood)
        {
            if (this.ScopesByMood.ContainsKey(mood))
            {
                BehaviorVariableValue variable = this.ScopesByMood[mood].GetVariable(key);
                if (variable != null)
                {
                    return(variable);
                }
            }

            if (this.behaviorVariables.ContainsKey(key))
            {
                return(this.behaviorVariables[key]);
            }

            return(null);
        }
        // TODO: Need to cover vanilla deserialisation for `CustomBehaviorVariableScope` type before this will work
        // TODO: Patch a call into this for the unit to save the data into the save file, or output as a companion save file
        public void Hydrate(SerializableReferenceContainer references)
        {
            Dictionary <string, BehaviorVariableValue>    itemDictionary  = references.GetItemDictionary <string, BehaviorVariableValue>(this, "serializableCustomBehaviorVariables");
            Dictionary <int, CustomBehaviorVariableScope> itemDictionary2 = references.GetItemDictionary <int, CustomBehaviorVariableScope>(this, "serializableCustomScopesByMood");

            this.behaviorVariables = new Dictionary <string, BehaviorVariableValue>(itemDictionary.Count);

            foreach (KeyValuePair <string, BehaviorVariableValue> keyValuePair in itemDictionary)
            {
                string key = (string)keyValuePair.Key;
                BehaviorVariableValue value = keyValuePair.Value;
                this.behaviorVariables.Add(key, value);
            }

            this.ScopesByMood = new Dictionary <AIMood, CustomBehaviorVariableScope>(itemDictionary2.Count);
            foreach (KeyValuePair <int, CustomBehaviorVariableScope> keyValuePair2 in itemDictionary2)
            {
                AIMood key2 = (AIMood)keyValuePair2.Key;
                CustomBehaviorVariableScope value2 = keyValuePair2.Value;
                this.ScopesByMood.Add(key2, value2);
            }
        }
Example #5
0
 public ScopeDesc(string name, AIMood mood, AISkillID aiSkillID) : this(name, mood)
 {
     this.AISkillID = aiSkillID;
     this.ScopeKind = ScopeKind.SkillBased;
 }
Example #6
0
 public ScopeDesc(string name, AIMood mood, AIPersonality aiPersonality) : this(name, mood)
 {
     this.AIPersonality = aiPersonality;
     this.ScopeKind     = ScopeKind.Personality;
 }
Example #7
0
 public ScopeDesc(string name, AIMood mood, UnitRole unitRole) : this(name, mood)
 {
     this.UnitRole  = unitRole;
     this.ScopeKind = ScopeKind.UnitRole;
 }