Ejemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            RecalculateLineGeometries();

            CreateMouseVisual();

            for (int cntr = 0; cntr < 42; cntr++)
            {
                SwarmBot2 swarmBot = new SwarmBot2();
                swarmBot.Radius      = .75d;
                swarmBot.ThrustForce = 6d;
                swarmBot.Behavior    = _activeBehavior;
                swarmBot.CreateBot(_viewport, _sharedVisuals, _world, Math3D.GetRandomVector(_boundryMin, _boundryMax).ToPoint());
                _swarmBots.Add(swarmBot);
            }

            // Now that they're all created, tell each about the others
            foreach (SwarmBot2 bot in _swarmBots)
            {
                foreach (SwarmBot2 otherBot in _swarmBots)
                {
                    if (otherBot == bot)
                    {
                        continue;
                    }

                    bot.OtherBots.Add(otherBot);
                }
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            RecalculateLineGeometries();

            CreateMouseVisual();

            for (int cntr = 0; cntr < 42; cntr++)
            {
                SwarmBot2 swarmBot = new SwarmBot2();
                swarmBot.Radius = .75d;
                swarmBot.ThrustForce = 6d;
                swarmBot.Behavior = _activeBehavior;
                swarmBot.CreateBot(_viewport, _sharedVisuals, _world, Math3D.GetRandomVector(_boundryMin, _boundryMax).ToPoint());
                _swarmBots.Add(swarmBot);
            }

            // Now that they're all created, tell each about the others
            foreach (SwarmBot2 bot in _swarmBots)
            {
                foreach (SwarmBot2 otherBot in _swarmBots)
                {
                    if (otherBot == bot)
                    {
                        continue;
                    }

                    bot.OtherBots.Add(otherBot);
                }
            }
        }