Пример #1
0
        public override void Reload()
        {
            winSize = DefaultSettings.Settings["WindowSize"];
            PhysicsManager = new PhysicsEngine(new Region(0, (float)winSize.Width, 0, (float)winSize.Height), 10);

            PhysicsManager.AddUniversalForce(DefaultForces.LinearDrag);
            //PhysicsManager.AddUniversalForce(DefaultForces.Gravity);

            var world = new List<WorldObject>();
            Random rand = new Random();

            ActiveMap = new Map(world);  // Create map from world

            // Walls -- invisible
            var w0 = new ROIDS.Sandbox.VertWallBody(new Vector2(0, winSize.Height / 2), winSize.Height);
            var w1 = new ROIDS.Sandbox.VertWallBody(new Vector2(winSize.Width, winSize.Height / 2), winSize.Height);

            var w2 = new ROIDS.Sandbox.HorizWallBody(new Vector2(winSize.Width / 2, 0), winSize.Width);
            var w3 = new ROIDS.Sandbox.HorizWallBody(new Vector2(winSize.Width / 2, winSize.Height), winSize.Width);

            PhysicsManager.MapBodies.Add(w0);
            PhysicsManager.MapBodies.Add(w1);
            PhysicsManager.MapBodies.Add(w2);
            PhysicsManager.MapBodies.Add(w3);

            //
            Console.WriteLine("HIT PERIOD TO DISABLE GRFX");
        }
Пример #2
0
        public override void Reload()
        {
            winSize = DefaultSettings.Settings["WindowSize"];
            PhysicsManager = new PhysicsEngine(new Region(0, (float)winSize.Width, 0, (float)winSize.Height), 10);

            PhysicsManager.AddUniversalForce(DefaultForces.LinearDrag);
            //PhysicsManager.AddUniversalForce(DefaultForces.Gravity);

            int maxAstroids = 10;

            var world = new List<WorldObject>();
            Random rand = new Random();

            var player = new Player(
                new Vector2((float)rand.NextDouble() * (winSize.Width - 50), (float)rand.NextDouble() * (winSize.Height - 50)),
                0f);

            world.Add(player);
            PhysicsManager.ActiveBodies.Add(player);

            int nx = 30;
            int ny = 30;
            var rad = 4f;
            var buf = 2f;
            var pos = new Vector2(winSize.Width / 2 - nx * (2f * rad + buf) / 2f, winSize.Height / 2 - ny * (2f * rad + buf) / 2f);
            for (int xi = 0; xi < nx; xi++)
            {
                for (int yi = 0; yi < ny; yi++)
                {
                    var pert = 0.1f * buf * (float)MathUtils.Rand.NextDouble() * MathUtils.RandDirection(); //minor perturbation from perfect grid.
                    var cent = pos + new Vector2((2f * rad + buf) * xi, (2f * rad + buf) * yi) + pert;
                    var obs = new InertRoid(cent, rad);

                    world.Add(obs);
                    PhysicsManager.ActiveBodies.Add(obs);
                }
            }

            ActiveMap = new Map(world);  // Create map from world

            // Walls -- invisible
            var w0 = new ROIDS.Sandbox.VertWallBody(new Vector2(0, winSize.Height / 2), winSize.Height);
            var w1 = new ROIDS.Sandbox.VertWallBody(new Vector2(winSize.Width, winSize.Height / 2), winSize.Height);

            var w2 = new ROIDS.Sandbox.HorizWallBody(new Vector2(winSize.Width / 2, 0), winSize.Width);
            var w3 = new ROIDS.Sandbox.HorizWallBody(new Vector2(winSize.Width / 2, winSize.Height), winSize.Width);

            PhysicsManager.MapBodies.Add(w0);
            PhysicsManager.MapBodies.Add(w1);
            PhysicsManager.MapBodies.Add(w2);
            PhysicsManager.MapBodies.Add(w3);

            //
            Console.WriteLine("CONTROLS:");
            Console.WriteLine("[LCLICK] - trigger explosion");
            Console.WriteLine("[RCLICK] - infect area");
        }
Пример #3
0
 public UIFrame(Vector2 location, Size size, bool isTransparent)
 {
     Controls = new List<Control>();
     Location = location;
     ElementSize = size;
     Transparent = isTransparent;
     BackgroundImage = null;
     PleaseDestroy = false;
 }
Пример #4
0
        public ListBox(Vector2 location, string[] text, SpriteFont font, Color fontColor, Size size)
            : base(location, size)
        {
            Text = new List<string>(text);
            SelectedItem = 0;

            Font = font;
            NormalColor = fontColor;
            SelectionColor = new Color(255 - NormalColor.R, 255 - NormalColor.G, 255 - NormalColor.B);

            _cellHeight = font.LineSpacing;
            DynamicallyResize = false;

            _bufferWidth = Vector2.Zero;

            this.KeyDown += new KeyEventHandler(ListBox_KeyDown);
            this.KeyUp += new KeyEventHandler(ListBox_KeyUp);
            this.KeyPressDown += new KeyEventHandler(ListBox_KeyPressDown);
            this.MouseClick += new MouseEventHandler(ListBox_MouseClick);
            this.MouseDown += new MouseEventHandler(ListBox_MouseDown);
        }
Пример #5
0
        public override void Reload()
        {
            winSize = DefaultSettings.Settings["WindowSize"];
            PhysicsManager = new PhysicsEngine(new Region(0, (float)winSize.Width, 0, (float)winSize.Height), 10);

            PhysicsManager.AddUniversalForce(DefaultForces.LinearDrag);
            //PhysicsManager.AddUniversalForce(DefaultForces.Gravity);

            var world = new List<WorldObject>();
            ActiveMap = new Map(world);
            Random rand = new Random();

            var player = new Player(
                new Vector2((float)rand.NextDouble() * (winSize.Width - 50), (float)rand.NextDouble() * (winSize.Height - 50)),
                0f);

            SpawnObject<Actor>(player);

            //
            //
            //

            int goodRoidNumber = 10;
            int BadRoidNumber = 5;

            for (int i = 0; i < goodRoidNumber; i++)
            {
                var pos = new Vector2((float)MathUtils.Rand.Next(50, (int)winSize.Width - 50), (float)MathUtils.Rand.Next(50, (int)winSize.Height - 50));
                var rad = 15f + (float)MathUtils.Rand.NextDouble() * 20;
                var gr = new GoodRoid(pos, rad, 50f, .1f, Vector2.Zero);
                SpawnObject<Actor>(gr);
            }

            for (int i = 0; i < BadRoidNumber; i++)
            {
                var pos = new Vector2((float)MathUtils.Rand.Next(50, (int)winSize.Width - 50), (float)MathUtils.Rand.Next(50, (int)winSize.Height - 50));
                var rad = 15f + (float)MathUtils.Rand.NextDouble() * 20;
                var br = new BadRoid(pos, rad, 50f, .1f, Vector2.Zero);
                SpawnObject<Actor>(br);
            }

            //
            //
            //

            // Walls -- invisible
            var w0 = new ROIDS.Sandbox.VertWallBody(new Vector2(0, winSize.Height / 2), winSize.Height);
            var w1 = new ROIDS.Sandbox.VertWallBody(new Vector2(winSize.Width, winSize.Height / 2), winSize.Height);

            var w2 = new ROIDS.Sandbox.HorizWallBody(new Vector2(winSize.Width / 2, 0), winSize.Width);
            var w3 = new ROIDS.Sandbox.HorizWallBody(new Vector2(winSize.Width / 2, winSize.Height), winSize.Width);

            PhysicsManager.MapBodies.Add(w0);
            PhysicsManager.MapBodies.Add(w1);
            PhysicsManager.MapBodies.Add(w2);
            PhysicsManager.MapBodies.Add(w3);

            //
            Console.WriteLine("CONTROLS:");
            Console.WriteLine("[LCLICK] - launch charge");
            Console.WriteLine("[RCLICK] - launch sensor");
            Console.WriteLine("[SPACE] - detonate all charges");
        }