示例#1
0
        public Missile(ParentGame game, Model modelObj, Texture2D[] modelTextures, DrawingClass drawClass, GameplayScreen Screen)
            : base(game, modelObj, modelTextures)
        {
            this.drawClass = drawClass;
            this.Screen = Screen;

            _body = new Body();
            _skin = new CollisionSkin(_body);
            _body.CollisionSkin = _skin;

            Box box = new Box(Vector3.Zero, Matrix.Identity, new Vector3(1f,1f,4f));
            _skin.AddPrimitive(box, new MaterialProperties(0.8f, 0.8f, 0.7f));

            Vector3 com = SetMass(2.0f);

            _body.MoveTo(position, Matrix.Identity);
            _skin.ApplyLocalTransform(new Transform(-com, Matrix.Identity));
            _body.EnableBody();

            Body.ExternalData = this;

            Vector3 pos = position;
            Vector3 forwardVec = Body.Orientation.Forward;
            forwardVec.Normalize();

            pos -= forwardVec * 10;
            // Use the particle emitter helper to output our trail particles.
            trailEmitter = new ParticleEmitter(drawClass.projectileTrailParticles,
                                               trailParticlesPerSecond, position);

            rgob = new RagdollObject(parentGame, null, null, null, RagdollObject.RagdollType.Simple, 1.0f, 3);
            rgob.Position = position;
            //rgob.PutToSleep();

            //rgob.limbs[0].PhysicsBody.AngularVelocity = (new Vector3(1, 1, 0) * 2000);

            RagdollTransforms = new List<Matrix>();

            RagdollTransforms = rgob.GetWorldMatrix();

            foreach (JigLibX.Objects.PhysicObject lim in rgob.limbs)
                DisableCollisions(lim.PhysicsBody, Body);

            foreach (JigLibX.Objects.PhysicObject lim in rgob.limbs)
                foreach (BuildingPiece pic in Screen.PieceList)
                    DisableCollisions(lim.PhysicsBody, pic.Body);

            foreach (JigLibX.Objects.PhysicObject lim in rgob.limbs)
                foreach (Building bld in Screen.Buildings)
                    DisableCollisions(lim.PhysicsBody, bld.Body);

            foreach (JigLibX.Objects.PhysicObject lim in rgob.limbs)
                DisableCollisions(lim.PhysicsBody, Screen.terrainActor.Body);

            foreach (JigLibX.Objects.PhysicObject limb0 in rgob.limbs)
                foreach (Missile mis in Screen.BulletList)
                    foreach (JigLibX.Objects.PhysicObject limb1 in mis.rgob.limbs)
                        DisableCollisions(limb1.PhysicsBody, limb0.PhysicsBody);
        }
示例#2
0
        public TerrainEditor(ParentGame parentGame,
            GameplayScreen gameScreen, TerrainEngine terrainEngine)
        {
            this.parentGame = parentGame;
            this.gameScreen = gameScreen;
            this.terrainEngine = terrainEngine;

            posList = new List<Vector3>();
            vectorList = new List<int>();
            BigChangeList = new List<int>();
        }
示例#3
0
        public BuildingPiece(ParentGame game, Model modelObj, Texture2D[] modelTextures,
            DrawingClass drawClass, GameplayScreen Screen, float Length, float Width, float Height)
            : base(game, modelObj, modelTextures)
        {
            // Use the particle emitter helper to output our trail particles.
            trailEmitter = new ParticleEmitter(drawClass.smokePlumeParticles,
                                               3, position);

            fireEmitter = new ParticleEmitter(drawClass.fireParticles,
                                               30, position);

            this.Screen = Screen;
            this.drawClass = drawClass;

            _body = new Body();
            _skin = new CollisionSkin(_body);
            _body.CollisionSkin = _skin;

            //Box box = new Box(Vector3.Zero, Matrix.Identity, new Vector3(10f, 7f, 7f));
            Box box = new Box(Vector3.Zero, Matrix.Identity, new Vector3(Length, Width, Height));
            if (Length > Width && Length > Height)
                boundSphere.Radius = Length;
            else if (Width > Length && Width > Height)
                boundSphere.Radius = Width;
            else
                boundSphere.Radius = Height;
            _skin.AddPrimitive(box, new MaterialProperties(0.8f, 0.8f, 0.7f));

            Vector3 com = SetMass(3.0f);

            _body.MoveTo(position, Matrix.Identity);
            _skin.ApplyLocalTransform(new Transform(-com, Matrix.Identity));
            _body.EnableBody();

            Body.ExternalData = this;

            SetBody(rotation);

            Body.AllowFreezing = true;
            Body.SetDeactivationTime(1);

            foreach (BuildingPiece pic in Screen.PieceList)
                DisableCollisions(this.Body, pic.Body);

            foreach (Building bld in Screen.Buildings)
                DisableCollisions(this.Body, bld.Body);
        }
示例#4
0
        public Building(ParentGame game, Model modelObj, Texture2D[] modelTextures,
            Vector3 Position, float Scale, Vector3 Rotation, string Type, GameplayScreen Screen)
            : base(game, modelObj, modelTextures)
        {
            // Use the particle emitter helper to output our trail particles.
            //trailEmitter = new ParticleEmitter(parentGame.projectileTrailParticles,
            //                                   trailParticlesPerSecond, position);

            this.Screen = Screen;
            this.drawClass = Screen.NormalDrawing;
            this.Type = Type;

            position = Position;
            scale = Scale;
            rotation = Rotation;

            Initialize();
        }
示例#5
0
 public Ring(ParentGame game, Model modelObj, Texture2D[] modelTextures, 
     Vector3 Position, float Scale, Vector3 Rotation, string Type, GameplayScreen Screen)
     : base(game, modelObj, modelTextures,
     Position, Scale, Rotation, Type, Screen)
 {
 }
示例#6
0
        public DrawingClass(ParentGame parentGame, GameplayScreen levelVariables,
            List<Missile> BulletList, List<Building> BuildingList, List<BuildingPiece> PieceList)
        {
            this.parentGame = parentGame;
            this.LV = levelVariables;
            this.BulletList = BulletList;
            this.BuildingList = BuildingList;
            this.PieceList = PieceList;

            device = parentGame.GraphicsDevice;
            PresentationParameters PP = device.PresentationParameters;
            spriteBatch = parentGame.spriteBatch;

            windowHeight = PP.BackBufferHeight;
            windowWidth = PP.BackBufferWidth;

            objEffect = parentGame.objEffect;
            //shadowMapShader = parentGame.Content.Load<Effect>("Effect\\DrawShadowMap");
            GausBlur = parentGame.Content.Load<Effect>("Effect\\GaussianBlur");
            effectPostDoF = parentGame.Content.Load<Effect>("Effect\\PostProcessDoF");
            depthMapShader = parentGame.Content.Load<Effect>("Effect\\Shader");
            font = parentGame.Content.Load<SpriteFont>("Font\\SpriteFont1");
            Lines = parentGame.Content.Load<Texture2D>("Radar\\lines3");
            Post = parentGame.Content.Load<Texture2D>("Radar\\post_screen");
            PowerBar = parentGame.Content.Load<Texture2D>("Radar\\power_bar");
            PowerCase = parentGame.Content.Load<Texture2D>("Radar\\power_case");
            Bullets = parentGame.Content.Load<Texture2D>("Radar\\bullets");
            Angle = parentGame.Content.Load<Texture2D>("Radar\\angle");
            WinBack = parentGame.Content.Load<Texture2D>("WinLoose\\win_back");
            LooseBack = parentGame.Content.Load<Texture2D>("WinLoose\\loose_back");
            TitlesFont = parentGame.Content.Load<SpriteFont>("Font\\sten36bld");
            TitlesFont2 = parentGame.Content.Load<SpriteFont>("Font\\Titles_font2");
            FireworkSheet = parentGame.Content.Load<Texture2D>("Firework\\firework_sheet");
            Timer = parentGame.Content.Load<Texture2D>("Radar\\timer");

            blurredScene = new Texture2D(device, windowWidth, windowHeight);
            depthTexture = new Texture2D(device, windowWidth, windowHeight);
            sceneTexture = new Texture2D(device, windowWidth, windowHeight);

            InitializeRenderTargets();

            InitializeParticles();

            lightPower = 0.9f;
            ambientPower = 0.2f;

            debugDrawer = new DebugDrawer(parentGame);
            debugDrawer.Enabled = true;
            parentGame.Components.Add(debugDrawer);

            SpecularColor = Color.Purple.ToVector4();
            SpecularIntensity = 1.0f;
            Shinniness        = 500.0f;

            float screenscale =
                (float)device.Viewport.Width / 848f;
            // Create the scale transform for Draw.
            // Do not scale the sprite depth (Z=1).
            SpriteScale = Matrix.CreateScale(screenscale, screenscale, 1);

            ssX = screenscale;

            WLScale.X = (float)device.Viewport.Width / 800f;
            WLScale.Y = (float)device.Viewport.Height / 600f;

            InitializeBones();
            boundFrustum = new BoundingFrustum(viewMatrix * projectionMatrix);
        }