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); }
public override bool Check(InputCondition inputCondition, Agent agent, Mapping mapping, Entity target, bool isRecheck) { // Look at all of the InventoryGroupings in this MappingType - See what EntityTypes match // TODO: Figure out how inventoryTarget gets set List <TypeGroup> groupings = inputCondition.InventoryTypeGroups(mapping.mappingType, out List <int> indexesToSet); if (groupings == null) { Debug.LogError(agent.name + ": OtherCanAddInventoryICT missing InventoryGroupings - MT = " + mapping.mappingType); return(false); } List <EntityType> possibleEntityTypes = TypeGroup.InAllTypeGroups(groupings, agent.memoryType.GetKnownEntityTypes(agent)); foreach (EntityType entityType in possibleEntityTypes) { if (target.inventoryType.FindInventorySlot(target, entityType) != null) { return(true); } } return(false); }