Example #1
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            float waitTime;

            if (outputChange.valueType == OutputChange.ValueType.Selector)
            {
                waitTime = outputChange.selector.GetFloatValue(agent, mapping);
            }
            else
            {
                waitTime = outputChange.floatValue;
            }

            if (outputChange.boolValue && waitTime != -1f)
            {
                waitTime *= agent.timeManager.RealTimeSecondsPerGameMinute();
            }

            Debug.Log(agent.name + ": WaitOCT - waiting for " + waitTime);

            agent.behavior.SetIsWaiting(waitTime);
            return(true);
        }
Example #2
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            // TODO: Feels like checks like these should be done once at start of game - InitCheck?
            if (!(outputChange.unityObject is Material material))
            {
                Debug.LogError(agent.name + ": MappingType: " + mapping.mappingType.name + " - ChangeMaterialOCT: Material is invalid.");
                return(false);
            }

            Renderer renderer = target.GetComponentInChildren <Renderer>();

            if (renderer == null)
            {
                Debug.LogError(agent.name + ": MappingType: " + mapping.mappingType.name + " - ChangeMaterialOCT: target (" +
                               target.name + ") has no renderer.");
                return(false);
            }

            Material oldMaterial = renderer.material;

            renderer.material = material;

            if (outputChange.floatValue > 0f)
            {
                agent.StartCoroutine(RevertMaterial(renderer, oldMaterial, outputChange.floatValue));
            }

            return(true);
        }
Example #3
0
        public override bool Match(Agent agent, OutputChange outputChange, MappingType outputChangeMappingType,
                                   InputCondition inputCondition, MappingType inputConditionMappingType)
        {
            List <InputCondition> inputConditionsFromOC = outputChangeMappingType.EntityTypeInputConditions();
            List <EntityType>     entityTypes           = TypeGroup.PossibleEntityTypes(inputConditionsFromOC, agent.memoryType.GetKnownEntityTypes(agent));

            if (inputConditionMappingType.AnyEntityTypeMatchesTypeGroups(entityTypes) &&
                inputCondition.levelType == outputChange.levelType)
            {
                // Same EntityType and same TagType - match adding tag to needing tag and removing tag to can't have tag
                if (!outputChange.boolValue &&
                    ((HasTagICT.Scope)inputCondition.enumValueIndex == HasTagICT.Scope.DoesNotHaveOwnerTag ||
                     (HasTagICT.Scope)inputCondition.enumValueIndex == HasTagICT.Scope.DoesNotHaveTag))
                {
                    return(true);
                }
                else if (outputChange.boolValue &&
                         ((HasTagICT.Scope)inputCondition.enumValueIndex == HasTagICT.Scope.HasTagButNotOwner ||
                          (HasTagICT.Scope)inputCondition.enumValueIndex == HasTagICT.Scope.HasTagIgnoreOwnership ||
                          (HasTagICT.Scope)inputCondition.enumValueIndex == HasTagICT.Scope.HasTagIsOwner))
                {
                    return(true);
                }
            }
            return(false);
        }
Example #4
0
        // Returns the index of the first OutputChangeType that matches the InputConditionType or -1 if no matches
        public int OutputChangeTypeMatch(InputCondition inputCondition, MappingType inputConditionMappingType, List <EntityType> allEntityTypes)
        {
            for (int i = 0; i < outputChanges.Count; i++)
            {
                OutputChange outputChange = outputChanges[i];

                if (inputCondition.inputConditionType == null)
                {
                    Debug.LogError("MappingType " + inputConditionMappingType.name + " has an InputCondition with no InputConditionType.  Please Fix.");
                    return(-1);
                }
                if (outputChange.outputChangeType == null)
                {
                    Debug.LogError("MappingType " + name + " has an OutputChange with no OutputChangeType.  Please Fix.");
                    return(-1);
                }
                if (inputCondition.inputConditionType.matchingOCTs != null &&
                    inputCondition.inputConditionType.matchingOCTs.Contains(outputChange.outputChangeType) &&
                    outputChange.outputChangeType.PreMatch(outputChange, this, inputCondition, inputConditionMappingType, allEntityTypes))
                {
                    return(i);
                }
            }
            return(-1);
        }
Example #5
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            if (mapping.target is Agent)
            {
                // TODO: This is really confusing - fix it and make sure it works
                Agent otherAgent = target as Agent;
                if (target == agent)
                {
                    otherAgent = (Agent)mapping.target;
                }
                ((Agent)target).memoryType.ChangeRLevel(((Agent)target), otherAgent, actualAmount);
            }
            else if (mapping.target is AgentEvent)
            {
                // TODO: Move this into AgentEvent so that it can decide how to handle RLevel changes
                // Change this agent's R Level for all other attendees in this event
                AgentEvent agentEvent = (AgentEvent)mapping.target;

                foreach (AgentEvent.Attendee attendee in agentEvent.attendees)
                {
                    if (agent != attendee.agent)
                    {
                        agent.memoryType.ChangeRLevel(agent, attendee.agent, actualAmount);
                    }
                }
            }
            return(true);
        }
Example #6
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            int intAmount = (int)actualAmount;

            if (intAmount > 0)
            {
                int num = target.inventoryType.Add(target, outputChange.entityType, outputChange.intValue, null, intAmount);
                if (num != intAmount)
                {
                    Debug.LogError(target.name + ": InventoryCreateOCT only created " + num + "/" + intAmount + " of " + outputChange.entityType.name);
                }

                if (outputChange.levelType is TagType tagType)
                {
                    // TODO: This isn't right - need to get the actual inventory enties created from Add above
                    Entity entity = target.inventoryType.GetFirstEntityofEntityType(target, outputChange.entityType);
                    entity.AddTag(tagType, target);
                }
            }
            else if (intAmount < 0)
            {
                Debug.LogError("InventoryCreateOCT has a negative amount to take.  Amount To Create must be positive.");
            }
            return(true);
        }
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;
            if (!agent.animationType.ImplementsAnimationRigging())
            {
                Debug.Log(agent.name + ": SetAnimationRigTargetOCT - agent's AnimationType does not implement AnimationRigging.");
                return(true);
            }

            Vector3    position;
            Quaternion rotation;

            if (outputChange.targetType == OutputChange.TargetType.ToInventoryTarget)
            {
                position = mapping.inventoryTargets[outputChange.inventoryTypeGroupMatchIndex].transform.position;
                position = agent.transform.InverseTransformPoint(position);
                rotation = Quaternion.identity;
            }
            else if (outputChange.targetType == OutputChange.TargetType.ToSelf)
            {
                Transform transform = (Transform)outputChange.unityObject;
                position = transform.position;
                rotation = transform.rotation;
            }
            else
            {
                position = agent.transform.InverseTransformPoint(target.transform.position);
                rotation = Quaternion.identity;
            }

            agent.animationType.WarpRigConstraintTargetTo(agent, (int)outputChange.floatValue, position, rotation);

            return(true);
        }
Example #8
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            target.DestroySelf(agent);
            return(true);
        }
Example #9
0
        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);
        }
Example #10
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            List <InventorySlot> inventorySlots = target.entityType.canBeInInventorySlots.Select(x => x.inventorySlot).ToList();

            // TODO: Just drop it for now - do better logic later
            List <InventorySlot> possibleSlots = inventorySlots.Intersect(agent.agentType.inventorySlots).ToList();

            if (possibleSlots.Count == 0)
            {
                Debug.LogError(agent.name + ": ClearInventorySlotsOCT - unable to find a slot to clear.");
                return(false);
            }

            // This will do nothing if the target doesn't have all of the amount
            // TODO: Add in options to handle not enough inventory
            InventoryType.Item item = target.inventoryType.Remove(target, possibleSlots[0]);
            if (item == null)
            {
                return(false);
            }

            item.entity.inventoryType.Dropped(item.entity, item.inventorySlot);
            return(true);
        }
Example #11
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            EntityType entityType = outputChange.entityType;

            // If this is an AgentEvent location could need to be synced with WorldObject
            // TODO: if self use inventory drop location?
            Vector3 position = target.transform.position;
            //int prefabVariantIndex = (int)outputChange.floatValue;
            int prefabVariantIndex = 0;

            if (entityType.prefabVariants == null || entityType.prefabVariants.Count <= prefabVariantIndex)
            {
                Debug.LogError(agent.name + ": CreateEntityOCT: " + entityType.name + " does not have enough Prefab Variants.  " +
                               "Tried to access Prefab Variant Index = " + prefabVariantIndex + " - Please Fix.");
                return(false);
            }

            GameObject newGameObject = entityType.CreateEntity(prefabVariantIndex, position, entityType.prefabVariants[prefabVariantIndex].transform.rotation,
                                                               entityType.prefabVariants[prefabVariantIndex].transform.localScale, agent);
            Entity newEntity = newGameObject.GetComponent <Entity>();

            if (outputChange.boolValue)
            {
                mapping.target = newEntity;
            }

            if (outputChange.floatValue > 0f)
            {
                newEntity.DestroySelf(null, outputChange.floatValue);
            }

            return(true);
        }
Example #12
0
 private void RunOutputChanges(Agent agent, WorldObjectType.State newState, WorldObjectType.State currentState)
 {
     for (int i = 0; i < worldObjectType.statesOutputChanges.Count; i++)
     {
         OutputChange outputChange = worldObjectType.statesOutputChanges[i];
         // currentState can be null on Start
         if (newState.enterOutputChangesIndexes.Contains(i) || (currentState != null && currentState.exitOutputChangesIndexes.Contains(i)))
         {
             float amount = outputChange.outputChangeType.CalculateAmount(agent, this, outputChange, null);
             if (!outputChange.CheckConditions(this, agent, null, amount))
             {
                 Debug.Log(agent + ": WorldObject.RunOutputChanges - output conditions failed - " + this);
                 if (outputChange.stopType == OutputChange.StopType.OnOCCFailed)
                 {
                     return;
                 }
             }
             bool succeeded = outputChange.outputChangeType.MakeChange(agent, this, outputChange, null, amount, out bool forceStop);
             Debug.Log(agent + ": WorldObject.RunOutputChanges - output condition " + outputChange.outputChangeType.name + " - " + succeeded);
             if ((forceStop && !outputChange.blockMakeChangeForcedStop) ||
                 (outputChange.stopType == OutputChange.StopType.OnChangeFailed && !succeeded))
             {
                 return;
             }
         }
     }
 }
Example #13
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            int intAmount = (int)actualAmount;

            if (intAmount > 0)
            {
                List <InventoryType.Item> items = target.inventoryType.Remove(target, outputChange.entityType, intAmount, true);
                if (items == null || items.Count < intAmount)
                {
                    Debug.LogError("InventoryDestroyEntityTypeOCT was unable to destroy EntityTypes (" + outputChange.entityType.name +
                                   "). Only found " + (items == null ? "0" : items.Count.ToString()) + " out of " + intAmount + ".");
                    return(false);
                }
                foreach (InventoryType.Item item in items)
                {
                    item.entity.DestroySelf(agent);
                }
            }
            else if (intAmount <= 0)
            {
                Debug.LogError("InventoryDestroyEntityTypeOCT has a negative amount to take.  Amount To Destroy must be positive.");
                return(false);
            }
            return(true);
        }
Example #14
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            // Make sure target is still there
            // TODO: Do an in range check - not exactly sure what the range should be for pickup?
            if (target.inEntityInventory != null)
            {
                Debug.Log(agent.name + ": InventoryPickupOCT - Target Entity " + target.name + " is gone.");
                return(false);
            }

            InventorySlot inventorySlot;

            if (outputChange.boolValue)
            {
                inventorySlot = agent.inventoryType.ClearSlotsAndAdd(agent, target);
            }
            else
            {
                inventorySlot = agent.inventoryType.Add(agent, target);
            }

            if (inventorySlot == null)
            {
                Debug.LogError(agent.name + ": InventoryPickupOCT unable to find inventorySlot for " + target.name);
                return(false);
            }
            return(true);
        }
Example #15
0
 public override float CalculateAmount(Agent agent, Entity target, OutputChange outputChange, Mapping mapping)
 {
     if (outputChange.valueType == OutputChange.ValueType.ActionSkillCurve)
     {
         return(outputChange.actionSkillCurve.Eval0to100(agent.ActionSkillWithItemModifiers(mapping.mappingType.actionType)));
     }
     return(outputChange.floatValue);
 }
Example #16
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            ((WorldObject)target).ChangeDamage(actualAmount);

            return(true);
        }
Example #17
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            float actualChange = ((Agent)target).attributes[(AttributeType)outputChange.levelType].ChangeLevelRelative(actualAmount);

            return(true);
        }
Example #18
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            // Near Entity change just passes target up to its parent - agent will be near the target after action (or recheck will fail for next mapping)
            //if (mapping.parent != null)
            //    mapping.parent.target = mapping.target;
            return(true);
        }
Example #19
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            // TODO: Use animationType if agent?
            Animator animator = target.GetComponentInChildren <Animator>();

            // TODO: Feels like checks like these should be done once at start of game - InitCheck?
            if (animator == null)
            {
                Debug.LogError(agent.name + ": MappingType: " + mapping.mappingType.name + " - SetAnimatorParamOCT: target " + target.name + " has no animator.");
                return(false);
            }
            bool selectorValid = outputChange.selector.IsValid();

            if (outputChange.stringValue == "" && !selectorValid)
            {
                Debug.LogError(agent.name + ": MappingType: " + mapping.mappingType.name + " - SetAnimatorParamOCT: Animator Param name " +
                               "String Value is blank and Selector is not valid.  One of them must be set.");
                return(false);
            }

            string paramName = outputChange.stringValue;

            if (selectorValid)
            {
                paramName = outputChange.selector.GetEnumValue <string>(agent, mapping);
            }

            switch (outputChange.valueType)
            {
            case OutputChange.ValueType.None:
                animator.SetTrigger(paramName);
                break;

            case OutputChange.ValueType.OppPrevOutputAmount:
                animator.SetFloat(paramName, -mapping.previousOutputChangeAmount);
                break;

            case OutputChange.ValueType.PrevOutputAmount:
                animator.SetFloat(paramName, mapping.previousOutputChangeAmount);
                break;

            case OutputChange.ValueType.BoolValue:
                animator.SetBool(paramName, outputChange.boolValue);
                break;

            case OutputChange.ValueType.FloatValue:
                animator.SetFloat(paramName, outputChange.floatValue);
                break;

            default:
                break;
            }

            return(true);
        }
Example #20
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            int intAmount = (int)actualAmount;

            if (intAmount > 0)
            {
                // Figure out possible EntityTypes from ICs InventoryGroupings - just pick first one
                List <EntityType> entityTypes;
                if (outputChange.inventoryTypeGroupMatchIndex > -1 && outputChange.inventoryTypeGroupMatchIndex < mapping.mappingType.inputConditions.Count)
                {
                    InputCondition inputCondition = mapping.mappingType.inputConditions[outputChange.inventoryTypeGroupMatchIndex];
                    entityTypes = inputCondition.GetInventoryTypeGroup().GetMatches(target.inventoryType.GetAllEntityTypes(target));
                }
                else if (outputChange.inventoryTypeGroupMatchIndex == -1)
                {
                    entityTypes = TypeGroup.PossibleEntityTypes(mapping.mappingType.inputConditions, agent.inventoryType.GetAllEntityTypes(agent), true);
                }
                else
                {
                    Debug.LogError(agent.name + ": InventoryDropOCT has an invalid value for inventoryGroupingMatchIndex in MT: " +
                                   mapping.mappingType.name);
                    return(false);
                }

                if (entityTypes == null || entityTypes.Count == 0)
                {
                    Debug.LogError(agent.name + ": InventoryDropOCT was unable to find an EntityType from ICs InventoryGroupings for MT: " +
                                   mapping.mappingType.name);
                    return(false);
                }
                // TODO: Add in InventoryTFs to MTs
                EntityType entityType = entityTypes[0];

                // This will do nothing if the target doesn't have all of the amount
                // TODO: Add in options to handle not enough inventory
                List <InventoryType.Item> items = target.inventoryType.Remove(target, entityType, intAmount, true);
                if (items == null)
                {
                    return(false);
                }

                foreach (InventoryType.Item item in items)
                {
                    // TODO: If Entity was created as Inventory it would have never gone through initialization
                    //       so it won't have an inventoryType set.  Make sure Entities created in inventory get initialized?
                    //item.entity.inventoryType.Dropped(item.entity, item.inventorySlot);
                    agent.inventoryType.Dropped(item.entity, item.inventorySlot);
                }
            }
            else if (intAmount < 0)
            {
                Debug.LogError("InventoryDropOCT has a negative amount to take.  Amount To Drop must be positive.");
            }
            return(true);
        }
Example #21
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            EntityType inventoryTargetEntityType = mapping.inventoryTargets[outputChange.inventoryTypeGroupMatchIndex].entityType;

            actualAmount = target.inventoryType.Add(target, inventoryTargetEntityType, 0, null, (int)actualAmount);
            return(true);
        }
Example #22
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            Entity inventoryTargetEntity = mapping.inventoryTargets[outputChange.inventoryTypeGroupMatchIndex];

            target.inventoryType.MoveInventorySlot(target, inventoryTargetEntity, outputChange.boolValue, true);

            return(true);
        }
Example #23
0
 public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
 {
     forceStop = false;
     if (target is Agent targetAgent)
     {
         targetAgent.decider.InterruptMapping(false);
         return(true);
     }
     return(false);
 }
Example #24
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            int intAmount = (int)actualAmount;

            if (intAmount > 0)
            {
                // Figure out possible EntityTypes from ICs InventoryGroupings - just pick first one
                List <EntityType> entityTypes;
                if (outputChange.inventoryTypeGroupMatchIndex > -1 && outputChange.inventoryTypeGroupMatchIndex < mapping.mappingType.inputConditions.Count)
                {
                    InputCondition inputCondition = mapping.mappingType.inputConditions[outputChange.inventoryTypeGroupMatchIndex];
                    entityTypes = inputCondition.GetInventoryTypeGroup().GetMatches(agent.inventoryType.GetAllEntityTypes(agent));
                }
                else if (outputChange.inventoryTypeGroupMatchIndex == -1)
                {
                    entityTypes = TypeGroup.PossibleEntityTypes(mapping.mappingType.inputConditions, agent.inventoryType.GetAllEntityTypes(agent), true);
                }
                else
                {
                    Debug.LogError(agent.name + ": InventoryGiveOCT has an invalid value for inventoryGroupingMatchIndex in MT: " +
                                   mapping.mappingType.name);
                    return(false);
                }

                if (entityTypes == null || entityTypes.Count == 0)
                {
                    Debug.LogError(agent.name + ": InventoryGiveOCT was unable to find an EntityType from ICs InventoryGroupings for MT: " +
                                   mapping.mappingType.name);
                    return(false);
                }
                // TODO: Add in InventoryTFs to MTs
                EntityType entityType = entityTypes[0];

                List <InventoryType.Item> items = agent.inventoryType.Remove(agent, entityType, intAmount, true);
                int numGiven = target.inventoryType.Add(target, items);

                if (numGiven != intAmount)
                {
                    // TODO: Handle partial gives
                    // Failed to Give items for some reason - give back inventory to agent
                    agent.inventoryType.Add(agent, items);

                    Debug.Log(agent.name + ": InventoryGiveOCT was unable to give all to target.  Tried to give " + intAmount + " - gave " + numGiven);
                    return(false);
                }
            }
            else if (intAmount < 0)
            {
                Debug.LogError(agent.name + ": InventoryGiveOCT has a negative amount to take.  Amount To Give must be positive.");
                return(false);
            }
            return(true);
        }
Example #25
0
        public override bool Check(ChangeCondition changeCondition, OutputChange outputChange, Agent agent,
                                   Entity target, Mapping mapping, float actualAmount)
        {
            WorldObject worldObject = mapping.target as WorldObject;

            if (worldObject != null && worldObject.isComplete == changeCondition.boolValue)
            {
                return(true);
            }
            return(false);
        }
Example #26
0
        public override bool Check(ChangeCondition changeCondition, OutputChange outputChange, Agent agent,
                                   Entity target, Mapping mapping, float actualAmount)
        {
            Agent targetAgent = mapping.target as Agent;

            if (targetAgent != null && targetAgent.gender == Agent.Gender.Male && changeCondition.boolValue)
            {
                return(true);
            }
            return(false);
        }
Example #27
0
        public override bool MakeChange(Agent agent, Entity target, OutputChange outputChange, Mapping mapping, float actualAmount, out bool forceStop)
        {
            forceStop = false;

            if (agent.inAgentEvent == null)
            {
                return(false);
            }
            agent.QuitEvent();
            return(true);
        }
Example #28
0
 public virtual void RecordOutputChangeLog(Agent agent, Mapping mapping, OutputChange outputChange, float amount, bool succeeded)
 {
     agentsOutputChangeLogs[agent].Add(new OutputChangeLog()
     {
         time         = Time.time,
         mapping      = mapping,
         outputChange = outputChange,
         amount       = amount,
         succeeded    = succeeded
     });
 }
Example #29
0
        public override bool PreMatch(OutputChange outputChange, MappingType outputChangeMappingType, InputCondition inputCondition,
                                      MappingType inputConditionMappingType, List <EntityType> allEntityTypes)
        {
            // The EntityType being created need match with the ICMT's EntityType TypeGroup Target
            List <TypeGroup> typeGroups = inputConditionMappingType.EntityTypeGroupings();

            if (outputChange.entityType.InAllTypeGroups(typeGroups))
            {
                return(true);
            }
            return(false);
        }
Example #30
0
        public override bool Match(Agent agent, OutputChange outputChange, MappingType outputChangeMappingType,
                                   InputCondition inputCondition, MappingType inputConditionMappingType)
        {
            List <InputCondition> inputConditionsFromOC = outputChangeMappingType.EntityTypeInputConditions();
            List <EntityType>     entityTypes           = TypeGroup.PossibleEntityTypes(inputConditionsFromOC, agent.memoryType.GetKnownEntityTypes(agent));

            if (inputConditionMappingType.AnyEntityTypeMatchesTypeGroups(entityTypes))
            {
                return(true);
            }
            return(false);
        }