Esempio n. 1
0
        private bool Filter(PerceptionTracker tracker, GameObject Rabbit, PerceptionStimulus perceptionStimulus)
        {
            if (perceptionStimulus.stimSource != Rabbit)
            {
                PerceptionTracker.AgentStatus Type = tracker.agentStatus;

                int validAgentTypes = tracker.agentStatusFilter;

                PerceptionTracker.AgentStatus sourceAgentType;

                if (perceptionStimulus.stimSource.GetComponent <PerceptionTracker>() == null)
                {
                    sourceAgentType = PerceptionTracker.AgentStatus.Wolf;
                }
                else
                {
                    sourceAgentType = perceptionStimulus.stimSource.GetComponent <PerceptionTracker>().agentStatus;
                }

                if ((sourceAgentType == PerceptionTracker.AgentStatus.Rabbit) && (Type == PerceptionTracker.AgentStatus.Wolf) && ((validAgentTypes & PerceptionTracker.RABBIT) != 0))
                {
                    return(true);
                }
                if ((sourceAgentType == PerceptionTracker.AgentStatus.Rabbit) && (Type == PerceptionTracker.AgentStatus.Rabbit) && ((validAgentTypes & PerceptionTracker.WOLF) != 0))
                {
                    return(true);
                }
                if ((sourceAgentType == PerceptionTracker.AgentStatus.Rabbit) && (Type == PerceptionTracker.AgentStatus.Neutral) && ((validAgentTypes & PerceptionTracker.NEUTRAL) != 0))
                {
                    return(true);
                }

                if ((sourceAgentType == PerceptionTracker.AgentStatus.Wolf) && (Type == PerceptionTracker.AgentStatus.Wolf) && ((validAgentTypes & PerceptionTracker.WOLF) != 0))
                {
                    return(true);
                }
                if ((sourceAgentType == PerceptionTracker.AgentStatus.Wolf) && (Type == PerceptionTracker.AgentStatus.Rabbit) && ((validAgentTypes & PerceptionTracker.RABBIT) != 0))
                {
                    return(true);
                }
                if ((sourceAgentType == PerceptionTracker.AgentStatus.Wolf) && (Type == PerceptionTracker.AgentStatus.Neutral) && ((validAgentTypes & PerceptionTracker.NEUTRAL) != 0))
                {
                    return(true);
                }

                if ((sourceAgentType == PerceptionTracker.AgentStatus.Neutral) && (Type == PerceptionTracker.AgentStatus.Wolf) && ((validAgentTypes & PerceptionTracker.NEUTRAL) != 0))
                {
                    return(true);
                }
                if ((sourceAgentType == PerceptionTracker.AgentStatus.Neutral) && (Type == PerceptionTracker.AgentStatus.Rabbit) && ((validAgentTypes & PerceptionTracker.NEUTRAL) != 0))
                {
                    return(true);
                }
                if ((sourceAgentType == PerceptionTracker.AgentStatus.Neutral) && (Type == PerceptionTracker.AgentStatus.Neutral) && ((validAgentTypes & PerceptionTracker.NEUTRAL) != 0))
                {
                    return(true);
                }

                return(false);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 public void AcceptStimulus(PerceptionStimulus stimulus)
 {
     StimBuffer.Add(stimulus);
 }
 public void FilteredStimulus(PerceptionStimulus percepStimulus)
 {
     Debug.Log("Type : " + percepStimulus.StimType + " from " + percepStimulus.stimSource);
 }