Пример #1
0
        public Manager(Map.Map map)
        {
            InRange = new Common.NearestNeighbours<Map.Destructible>(Vector2.Zero, Common.Math.ToVector2(map.Ground.Size), Program.Settings.AIInRangeGridSize);

             if (Program.Settings.MotionSettings.UseDummyMotion)
                 MotionSimulation = new Common.Motion.DummySimulation();
             else
             {
                 var sim = new Common.Motion.Simulation(map.NavMesh);
            #if BETA_RELEASE
                 sim.StepStart = () => PhysicsProfilers.Step.Start();
                 sim.StepStop = () => PhysicsProfilers.Step.Stop();

                 sim.UnitStepStart = () => PhysicsProfilers.UnitStep.Start();
                 sim.UnitStepStop = () => PhysicsProfilers.UnitStep.Stop();

                 sim.USFindStateStart = () => PhysicsProfilers.USFindState.Start();
                 sim.USFindStateStop = () => PhysicsProfilers.USFindState.Stop();

                 sim.USWalkStart = () => PhysicsProfilers.USWalk.Start();
                 sim.USWalkStop = () => PhysicsProfilers.USWalk.Stop();

                 sim.WalkSlideStart = () => PhysicsProfilers.WalkSlide.Start();
                 sim.WalkSlideStop = () => PhysicsProfilers.WalkSlide.Stop();

                 sim.USFlyStart = () => PhysicsProfilers.USFly.Start();
                 sim.USFlyStop = () => PhysicsProfilers.USFly.Stop();

                 sim.StaticBndUpdStart = () => PhysicsProfilers.StaticBndUpd.Start();
                 sim.StaticBndUpdStop = () => PhysicsProfilers.StaticBndUpd.Stop();

                 sim.UnitBndUpdStart = () => PhysicsProfilers.UnitBndUpd.Start();
                 sim.UnitBndUpdStop = () => PhysicsProfilers.UnitBndUpd.Stop();

                 sim.ProjStepStart = () => PhysicsProfilers.ProjStep.Start();
                 sim.ProjStepStop = () => PhysicsProfilers.ProjStep.Stop();

                 sim.UnitColDetStart = () => PhysicsProfilers.UnitColDet.Start();
                 sim.UnitColDetStop = () => PhysicsProfilers.UnitColDet.Stop();

                 sim.UnitColResStart = () => PhysicsProfilers.UnitColRes.Start();
                 sim.UnitColResStop = () => PhysicsProfilers.UnitColRes.Stop();

                 sim.UnitHeightAdjStart = () => PhysicsProfilers.UnitHeightAdj.Start();
                 sim.UnitHeightAdjStop = () => PhysicsProfilers.UnitHeightAdj.Stop();

                 sim.InterpolationStart = () => PhysicsProfilers.Interpolation.Start();
                 sim.InterpolationStop = () => PhysicsProfilers.Interpolation.Stop();
            #endif
                 sim.SetHeightMap(map.Ground.HeightmapFloats, new Vector2(map.Ground.Size.Width, map.Ground.Size.Height), Common.Math.ToVector2(map.Ground.Position));
                 sim.Settings = Program.Settings.MotionSettings;
                 if (Program.Settings.MotionSettings.UseMultiThreadedPhysics)
                     MotionSimulation = new Common.Motion.ThreadSimulationProxy(sim);
                 else
                     MotionSimulation = sim;
             }

            Pickups = new Common.Quadtree<Client.Game.Map.Pickup>(10);
        }
Пример #2
0
        public Form1()
        {
            InitializeComponent();
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);

            nn = new Common.NearestNeighbours<string>(SlimDX.Vector2.Zero,
                new SlimDX.Vector2(Width, Height), gridSize);
        }
Пример #3
0
        public Form1()
        {
            InitializeComponent();
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);

            nn = new Common.NearestNeighbours <string>(SlimDX.Vector2.Zero,
                                                       new SlimDX.Vector2(Width, Height), gridSize);
        }
Пример #4
0
        public Manager(Map.Map map)
        {
            InRange = new Common.NearestNeighbours <Map.Destructible>(Vector2.Zero, Common.Math.ToVector2(map.Ground.Size), Program.Settings.AIInRangeGridSize);

            if (Program.Settings.MotionSettings.UseDummyMotion)
            {
                MotionSimulation = new Common.Motion.DummySimulation();
            }
            else
            {
                var sim = new Common.Motion.Simulation(map.NavMesh);
#if BETA_RELEASE
                sim.StepStart = () => PhysicsProfilers.Step.Start();
                sim.StepStop  = () => PhysicsProfilers.Step.Stop();

                sim.UnitStepStart = () => PhysicsProfilers.UnitStep.Start();
                sim.UnitStepStop  = () => PhysicsProfilers.UnitStep.Stop();

                sim.USFindStateStart = () => PhysicsProfilers.USFindState.Start();
                sim.USFindStateStop  = () => PhysicsProfilers.USFindState.Stop();

                sim.USWalkStart = () => PhysicsProfilers.USWalk.Start();
                sim.USWalkStop  = () => PhysicsProfilers.USWalk.Stop();

                sim.WalkSlideStart = () => PhysicsProfilers.WalkSlide.Start();
                sim.WalkSlideStop  = () => PhysicsProfilers.WalkSlide.Stop();

                sim.USFlyStart = () => PhysicsProfilers.USFly.Start();
                sim.USFlyStop  = () => PhysicsProfilers.USFly.Stop();

                sim.StaticBndUpdStart = () => PhysicsProfilers.StaticBndUpd.Start();
                sim.StaticBndUpdStop  = () => PhysicsProfilers.StaticBndUpd.Stop();

                sim.UnitBndUpdStart = () => PhysicsProfilers.UnitBndUpd.Start();
                sim.UnitBndUpdStop  = () => PhysicsProfilers.UnitBndUpd.Stop();

                sim.ProjStepStart = () => PhysicsProfilers.ProjStep.Start();
                sim.ProjStepStop  = () => PhysicsProfilers.ProjStep.Stop();

                sim.UnitColDetStart = () => PhysicsProfilers.UnitColDet.Start();
                sim.UnitColDetStop  = () => PhysicsProfilers.UnitColDet.Stop();

                sim.UnitColResStart = () => PhysicsProfilers.UnitColRes.Start();
                sim.UnitColResStop  = () => PhysicsProfilers.UnitColRes.Stop();

                sim.UnitHeightAdjStart = () => PhysicsProfilers.UnitHeightAdj.Start();
                sim.UnitHeightAdjStop  = () => PhysicsProfilers.UnitHeightAdj.Stop();

                sim.InterpolationStart = () => PhysicsProfilers.Interpolation.Start();
                sim.InterpolationStop  = () => PhysicsProfilers.Interpolation.Stop();
#endif
                sim.SetHeightMap(map.Ground.HeightmapFloats, new Vector2(map.Ground.Size.Width, map.Ground.Size.Height), Common.Math.ToVector2(map.Ground.Position));
                sim.Settings = Program.Settings.MotionSettings;
                if (Program.Settings.MotionSettings.UseMultiThreadedPhysics)
                {
                    MotionSimulation = new Common.Motion.ThreadSimulationProxy(sim);
                }
                else
                {
                    MotionSimulation = sim;
                }
            }

            Pickups = new Common.Quadtree <Client.Game.Map.Pickup>(10);
        }
Пример #5
0
 protected override void StartPerform()
 {
     base.StartPerform();
     NNObject = Game.Instance.Mechanics.InRange.Insert(null, Performer.Position, Range, true);
     NNObject.EntersRange += new Action<Destructible, Destructible>(NNObject_EntersRange);
     NNObject.ExitsRange += new Action<Destructible, Destructible>(NNObject_ExitsRange);
     Performer.Moved += new EventHandler(MapUnit_Moved);
 }