コード例 #1
0
ファイル: AgentSight.cs プロジェクト: yazici/ann_ecosystem
        public HashSet <SimulatedAgent> GetStationaryAgentsInRangeWithTag(string tag)
        {
            var allAgents = AGENT_DB.GetStationaryAgentsWithTag(tag);

            if (allAgents.Count > 0)
            {
                var agentsInRange = new HashSet <SimulatedAgent>();

                foreach (var agent in allAgents)
                {
                    if (agent.transform.gameObject.GetInstanceID().Equals(m_ID))
                    {
                        continue;
                    }

                    float to = (agent.transform.position - transform.position).sqrMagnitude;

                    if (to < sightDistance * sightDistance)
                    {
                        agentsInRange.Add(agent);
                    }
                }

                return(agentsInRange);
            }

            return(allAgents);
        }
コード例 #2
0
ファイル: GASimulation.cs プロジェクト: yazici/ann_ecosystem
        private int NumOfVegetationToSpawn()
        {
            int numOfVeg = AGENT_DATABASE.GetStationaryAgentsWithTag("Vegetation").Count;

            return(maxVegetation - numOfVeg);
        }