示例#1
0
        public override void StartSimulation(IRTIambassador rtiAmb)
        {
            if (log.IsInfoEnabled)
            {
                log.Info("Start Boids simulation");
            }

            JoinSimulation(rtiAmb, color, "Boids");

            try
            {
                simulationThread = new Thread(new ThreadStart(SimulationLoop));
                boidsManager     = new BoidsManager(federateAmbassador);
                boidsManager.BuildBoids(NUMBER_BOIDS, new Vector3(750, 60, 750), color);
                BoidsSample app = new BoidsSample(boidsManager, color);
                simulationThread.Start();
                app.Go();
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Failed running simulation. Exception :" + e.Message);
                }
            }
        }
示例#2
0
        protected Boid(float velFactor, BoidsManager bh, Vector3 floorCenter, string boidColor)
        {
            maxSpeed = MAX_SPEED * velFactor;    // to vary the maxSpeed
            beh      = bh;
            //center = floorCenter;
            MAX_PT += floorCenter;
            MIN_PT += floorCenter;

            Position = floorCenter + new Vector3(RandPosn(),
                                                 (float)(random.NextDouble() * 6.0),
                                                 RandPosn());
            Velocity = new Vector3(RandVel(), RandVel(), RandVel());
            Color    = boidColor;
        }
示例#3
0
文件: Boid.cs 项目: superliujian/Sxta
        protected Boid(float velFactor, BoidsManager bh, Vector3 floorCenter, string boidColor)
        {
            maxSpeed = MAX_SPEED * velFactor;    // to vary the maxSpeed
            beh = bh;
            //center = floorCenter;
            MAX_PT += floorCenter;
            MIN_PT += floorCenter;

            Position = floorCenter + new Vector3(RandPosn(),
                                                (float)(random.NextDouble() * 6.0),
                                                RandPosn());
            Velocity = new Vector3(RandVel(), RandVel(), RandVel());
            Color = boidColor;
        }
示例#4
0
 public static Boid NewBoid(float velFactor, BoidsManager bh, Vector3 floorCenter, string boidColor)
 {
     return((Boid)NewInstance(myCallType, velFactor, bh, floorCenter, boidColor));
 }
示例#5
0
文件: Boid.cs 项目: superliujian/Sxta
 public static Boid NewBoid(float velFactor, BoidsManager bh, Vector3 floorCenter, string boidColor)
 {
     return (Boid)NewInstance(myCallType, velFactor, bh, floorCenter, boidColor);
 }
示例#6
0
        public override void StartSimulation(IRTIambassador rtiAmb)
        {
            if (log.IsInfoEnabled)
                log.Info("Start Boids simulation");

            JoinSimulation(rtiAmb, color, "Boids");

            try
            {
                simulationThread = new Thread(new ThreadStart(SimulationLoop));
                boidsManager = new BoidsManager(federateAmbassador);
                boidsManager.BuildBoids(NUMBER_BOIDS, new Vector3(750, 60, 750), color);
                BoidsSample app = new BoidsSample(boidsManager, color);
                simulationThread.Start();
                app.Go();
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("Failed running simulation. Exception :" + e.Message);
            }
        }
示例#7
0
 public BoidsSample(BoidsManager manager, string boidColor)
 {
     boidsManager = manager;
     color        = boidColor;
 }
示例#8
0
 public BoidsSample(BoidsManager manager, string boidColor)
 {
     boidsManager = manager;
     color = boidColor;
 }