Esempio n. 1
0
        void frame_KeyPressDown(Element sender, KeyEventArgs e)
        {
            switch (e.InterestingKeys[0])
            {
            case Keys.G:
                gactive = !gactive;
                if (gactive)
                {
                    PhysicsManager.AddUniversalForce(DefaultForces.Gravity);
                }
                else
                {
                    PhysicsManager.RemoveUniversalForce(DefaultForces.Gravity);
                }
                break;

            case Keys.X:
                var br = new BombRoid(new Vector2((float)MathUtils.Rand.Next(60, (int)winSize.Width - 60), winSize.Height), 25);
                br.Mass     = 100;
                br.Velocity = -1000 * Vector2.UnitY;
                br.FuseTime = .1f;
                ActiveMap.AddObject(br);
                PhysicsManager.ActiveBodies.Add(br);
                break;

            case Keys.C:
                var gr = new InertRoid(new Vector2((float)MathUtils.Rand.Next(60, (int)winSize.Width - 60), winSize.Height), 25);
                gr.Mass     = 100;
                gr.Velocity = -1000 * Vector2.UnitY;
                ActiveMap.AddObject(gr);
                PhysicsManager.ActiveBodies.Add(gr);
                break;

            case Keys.OemPeriod:
                draw = !draw;
                break;

            case Keys.Space:

                break;
            }
        }