Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
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)
            {
                if (targetAgent.attributes[(AttributeType)changeCondition.levelType].GetLevel() < changeCondition.floatValue)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #4
0
        public override bool Check(ChangeCondition changeCondition, OutputChange outputChange, Agent agent,
                                   Entity target, Mapping mapping, float actualAmount)
        {
            int index = -1;

            if (changeCondition.valueType == ChangeCondition.ValueType.Selector)
            {
                index = (int)changeCondition.selector.GetFloatValue(agent, mapping);
            }
            else if (changeCondition.valueType == ChangeCondition.ValueType.IntValue)
            {
                index = changeCondition.intValue;
            }

            OutputChange targetOutputChange;

            if (index == -1)
            {
                targetOutputChange = outputChange.Previous(mapping.mappingType);
            }
            else
            {
                targetOutputChange = mapping.mappingType.outputChanges[index];
            }

            // Find this one in history to see it has run and if so what result was
            // TODO: Reliance on History is bad - Add a structure in Decider?  Or DeciderType?
            // Dictionary<(Mapping, OutputChange), Status> - reset it when new plan starts
            HistoryType.OutputChangeLog outputChangeLog = agent.historyType.GetOutputChangeLog(agent, mapping, targetOutputChange);

            if (outputChangeLog == null)
            {
                Debug.LogError(agent.name + ": PreviousOCStatusCCT - unable to find OC status in HistoryType OutputChangeLog.");
                return(false);
            }

            if (outputChangeLog.succeeded == changeCondition.boolValue)
            {
                return(true);
            }
            return(false);
        }
Пример #5
0
        public override bool Check(ChangeCondition changeCondition, OutputChange outputChange, Agent agent,
                                   Entity target, Mapping mapping, float actualAmount)
        {
            float probability;

            if (changeCondition.selector.IsValid())
            {
                probability = changeCondition.selector.GetFloatValue(agent, mapping);
            }
            else
            {
                probability = changeCondition.floatValue;
            }

            if (probability >= Random.Range(0f, 100f))
            {
                return(true);
            }
            return(false);
        }
Пример #6
0
 public abstract bool Check(ChangeCondition changeCondition, OutputChange outputChange, Agent agent,
                            Entity target, Mapping mapping, float actualAmount);