예제 #1
0
 public override void Update()
 {
     base.Update();
     if (MInput.LeftClick())
     {
         Force += Math.Min(Vector2.Distance(MInput.Position.ToVector2(), Position), 50) * (MInput.Position.ToVector2() - Position) * World.Step;
     }
 }
예제 #2
0
        protected override void Initialize()
        {
            base.Initialize();

            Graphics.PreferMultiSampling       = true;
            Graphics.PreferredBackBufferWidth  = 1280;
            Graphics.PreferredBackBufferHeight = 720;
            Graphics.ApplyChanges();

            Render.Initialize(GraphicsDevice);
            KInput.Initialize();
            MInput.Initialize();

            World = new World();
        }
예제 #3
0
        public void Update()
        {
            MInput.Update();
            KInput.Update();

            if (!sorted)
            {
                Entities.Sort(this);
                sorted = true;
            }

            //updating in 3 steps
            Entities.ForEach((o) => o.BeforeUpdate());
            Entities.ForEach((o) => o.Update());
            Entities.ForEach((o) => o.AfterUpdate());
        }