Exemplo n.º 1
0
        public override void FireCommand(cWeapon owner)
        {
            cLevel lev = PrimalDevistation.Instance.Level;

            Vector2 where = Vector2.Zero;
            Vector2 vel = Vector2.Zero;

            if (_where == "this")
            {
                where.X = owner.Position.X; where.Y = owner.Position.Y;
            }
            if (_velocity == "this")
            {
                vel.X = owner.Velocity.X; vel.Y = owner.Velocity.Y;
            }
            if (_type == "explosion")
            {
                PrimalDevistation.Instance.Explode(_size, where, vel / 2f, owner.Owner, true);
            }
            else if (_type == "shrapnel")
            {
                List <Vector2> positions  = new List <Vector2>(_quantity);
                List <Vector2> velocities = new List <Vector2>(_quantity);
                List <Color>   colors     = new List <Color>(_quantity);
                Color          c          = new Color(200, 200, 200, 255);
                for (int i = 0; i < _quantity; i++)
                {
                    positions.Add(new Vector2(where.X + cMath.Rand(-4f, 4f), where.Y + cMath.Rand(-4f, 4f)));
                    velocities.Add(new Vector2(cMath.Rand(-1f, 1f) + vel.X / 10, cMath.Rand(-1f, 1f) + vel.Y / 10));
                    colors.Add(c);
                }
                PrimalDevistation.Instance.PhysicsParticles.SpawnParticles(positions, velocities, colors);
            }
        }
        public PrimalDevistation()
        {
            _instance           = this;
            _graphics           = new GraphicsDeviceManager(this);
            _content            = new ContentManager(Services, @"Resources");
            this.IsMouseVisible = true;
            _graphics.PreferredBackBufferWidth  = 1024;
            _graphics.PreferredBackBufferHeight = 768;
            //_graphics.MinimumPixelShaderProfile = ShaderProfile.PS_3_0;
            //_graphics.MinimumVertexShaderProfile = ShaderProfile.VS_3_0;

            // Create the console
            _console           = new cConsole(this);
            _console.DrawOrder = 90000;
            Components.Add(_console);

#if !XBOX
            // Create the debug mode object
            _debugComp = new cDebugMode(this);
            _console.AddCommand("debug", "toggles whether debug mode is active or not", delegate { _debugComp.Enabled = !_debugComp.Enabled; _debugComp.Visible = !_debugComp.Visible; });
            _debugComp.Enabled   = true;
            _debugComp.Visible   = true;
            _debugComp.DrawOrder = int.MaxValue - 1;
            Components.Add(_debugComp);
#endif

            _level           = new cLevel(this, 1, 1);
            _level.DrawOrder = 100;
            Components.Add(_level);

            _weapons           = new cWeaponFactory(this);
            _weapons.DrawOrder = 600;
            Components.Add(_weapons);

            _playerManager           = new cPlayerManager(this);
            _playerManager.DrawOrder = 900;
            Components.Add(_playerManager);

            // Create the particle system

            cPhysicsParticles360 parts1 = new cPhysicsParticles360(this);
            _physicsParticles = parts1;
            parts1.DrawOrder  = 700;
            Components.Add(parts1);


            //cPhysicsParticlesCPU parts2 = new cPhysicsParticlesCPU(this);
            //_physicsParticles = parts2;
            //parts2.DrawOrder = 700;
            //Components.Add(parts2);


            _particleEffectSystem           = new cParticleEffectSystem(this);
            _particleEffectSystem.DrawOrder = 800;
            Components.Add(_particleEffectSystem);

            _lineManager           = new LineManager(this);
            _lineManager.DrawOrder = 500;
            Components.Add(_lineManager);

            _console.AddCommand("bloom", "toggles bloom", delegate { _bloom.Enabled = !_bloom.Enabled; _bloom.Visible = !_bloom.Visible; });
            _bloom           = new BloomComponent(this);
            _bloom.DrawOrder = 2000;
            Components.Add(_bloom);


            _audio = new cAudio();
        }