示例#1
0
        /**
         * Sets up the distribution map for density and agent template.
         *
         * Example:
         * 20 : Template1 -> density of .20
         * 65 : Template2 -> density of .45
         * 100: Template3 -> density of .35
         */
        private void setupDistributionMap()
        {
            int accumulator = 0;

            for (int i = 0; i < config.AgentDistributions.Count; ++i)
            {
                AgentDistribution dist = config.AgentDistributions[i];

                accumulator += (int)(dist.Distribution * 100.0);
                Agent agent = createAgent(dist.AgentTemplate);

                distributionMap.Add(accumulator, agent);
            }
        }
示例#2
0
        /**
         * Sets up the group manager.
         */
        public void Setup()
        {
            this.setupDistributionMap();

            // Reset the position of the initial agents.
            // TODO: will be removed with a more complex positioning of characters.
            for (int i = 0; i < config.AgentDistributions.Count; i++)
            {
                AgentDistribution dist = config.AgentDistributions[i];

                float x = getRandomPosition(config.Point1.x, config.Point2.x);
                float z = getRandomPosition(config.Point1.y, config.Point2.y);

                dist.AgentTemplate.transform.position = new Vector3(x, 0, z);
            }
        }