public void IssueAiOrder(string type, string ownerGuid, CustomAIOrder aiOrder) { if (this.customBehaviourVariables.ContainsKey(type)) { Dictionary <string, CustomBehaviorVariableScope> typeScopes = this.customBehaviourVariables[type]; if (typeScopes.ContainsKey(ownerGuid)) { CustomBehaviorVariableScope customScope = typeScopes[ownerGuid]; customScope.IssueAIOrder(aiOrder); } } }
public void AddCustomBehaviourVariableScope(string type, string ownerGuid) { if (!customBehaviourVariables.ContainsKey(type)) { customBehaviourVariables[type] = new Dictionary <string, CustomBehaviorVariableScope>(); } if (!customBehaviourVariables[type].ContainsKey(ownerGuid)) { // Main.Logger.Log($"[AddCustomBehaviourVariableScope] Adding for {type} and {ownerGuid}"); customBehaviourVariables[type][ownerGuid] = new CustomBehaviorVariableScope(); } }
// TODO: Support global scopes [pilot personality, unit role, ai skill] on a later release // NOTE: Only supporting unit and lance to start with public BehaviorVariableValue GetBehaviourVariableValue(string type, string ownerGuid, string key) { if (this.customBehaviourVariables.ContainsKey(type)) { Dictionary <string, CustomBehaviorVariableScope> typeScopes = this.customBehaviourVariables[type]; if (typeScopes.ContainsKey(ownerGuid)) { CustomBehaviorVariableScope customScope = typeScopes[ownerGuid]; BehaviorVariableValue behaviourVariableValue = customScope.GetVariable(key); if (behaviourVariableValue != null) { return(behaviourVariableValue); } } } return(null); }