public override bool PreMatch(OutputChange outputChange, MappingType outputChangeMappingType, InputCondition inputCondition, MappingType inputConditionMappingType, List <EntityType> allEntityTypes) { // Matches OtherInventoryAmountICT // This needs to be giving the corrent EntityType (InventoryGroupings) based on what the ICT needs (InventoryGroupings) if (outputChange.inventoryTypeGroupMatchIndex == -1) { return(false); } InputCondition outputChangeInputCondition = outputChangeMappingType.inputConditions[outputChange.inventoryTypeGroupMatchIndex]; List <TypeGroup> groupings = outputChangeInputCondition.InventoryTypeGroups(outputChangeMappingType, out List <int> indexesToSet); // groupings is now the EntityTypes that are possible to be given List <EntityType> entityTypes = TypeGroup.InAllTypeGroups(groupings, allEntityTypes); // See if any of these EntityTypes matches what the IC of OtherInventoryAmountICT needs bool inventoryGroupMatches = inputCondition.AnyInventoryGroupingMatches(inputConditionMappingType, entityTypes); // Also need to make sure that possible EntityTypes from both MappingTypes have some overlap bool groupMatches = outputChangeMappingType.AnyEntityTypeMatchesTypeGroups(inputConditionMappingType, allEntityTypes); if (inventoryGroupMatches && groupMatches) { return(true); } return(false); }
public override bool Match(Agent agent, OutputChange outputChange, MappingType outputChangeMappingType, InputCondition inputCondition, MappingType inputConditionMappingType) { // Matches OtherInventoryAmountICT // This needs to be giving the corrent EntityType (InventoryGroupings) based on what the ICT needs (InventoryGroupings) InputCondition outputChangeInputCondition = outputChangeMappingType.inputConditions[outputChange.inventoryTypeGroupMatchIndex]; List <TypeGroup> groupings = outputChangeInputCondition.InventoryTypeGroups(outputChangeMappingType, out List <int> indexesToSet); // groupings is now the EntityTypes that are possible to be given List <EntityType> entityTypes = TypeGroup.InAllTypeGroups(groupings, agent.memoryType.GetKnownEntityTypes(agent, true)); // See if any of these EntityTypes matches what the IC of OtherInventoryAmountICT needs if (inputCondition.AnyInventoryGroupingMatches(inputConditionMappingType, entityTypes)) { return(true); } return(false); }
public override bool Match(Agent agent, OutputChange outputChange, MappingType outputChangeMappingType, InputCondition inputCondition, MappingType inputConditionMappingType) { // This matches with InventoryAmountICT // Matches the InventoryAmountICT InventoryGroup with this OC's InventoryGroup InputCondition outputChangeInputCondition = outputChangeMappingType.inputConditions[outputChange.inventoryTypeGroupMatchIndex]; List <TypeGroup> groupings = outputChangeInputCondition.InventoryTypeGroups(outputChangeMappingType, out List <int> indexesToSet); // Groupings is now the EntityTypes that are possible to be taken // Need to use allEntityTypes in world since agent may be trying to get an EntityType this is in inventory List <EntityType> entityTypes = TypeGroup.InAllTypeGroups(groupings, agent.totalAIManager.allEntityTypes); if (inputCondition.AnyInventoryGroupingMatches(inputConditionMappingType, entityTypes)) { return(true); } return(false); }