예제 #1
0
파일: CModel.cs 프로젝트: Cerwym/molyjam
        public virtual void DrawCollisions(ChaseCamera camera, GraphicsDevice graphicsDevice)
        {
            // Initialize an array of indices for the box. 12 lines require 24 indices
            short[] bBoxIndices = {
                0, 1, 1, 2, 2, 3, 3, 0, // Front edges
                4, 5, 5, 6, 6, 7, 7, 4, // Back edges
                0, 4, 1, 5, 2, 6, 3, 7 // Side edges connecting front and back
            };

            // Use inside a drawing loop
            foreach (BoundingBox box in boundingBoxes)
            {
                Vector3[] corners = box.GetCorners();
                VertexPositionColor[] primitiveList = new VertexPositionColor[corners.Length];

                // Assign the 8 box vertices
                for (int i = 0; i < corners.Length; i++)
                {
                    primitiveList[i] = new VertexPositionColor(corners[i], Color.White);
                }

                boxEffect.World = Matrix.Identity;
                boxEffect.View = camera.View;
                boxEffect.Projection = camera.Projection;
                boxEffect.TextureEnabled = false;

                // Draw the box with a LineList
                foreach (EffectPass pass in boxEffect.CurrentTechnique.Passes)
                {
                    pass.Apply();
                    graphicsDevice.DrawUserIndexedPrimitives(
                        PrimitiveType.LineList, primitiveList, 0, 8,
                        bBoxIndices, 0, 12);
                }
            }
        }
예제 #2
0
파일: Game1.cs 프로젝트: Cerwym/molyjam
        public Game1()
        {
            showCollisions = false;
            graphics = new GraphicsDeviceManager(this);
            graphics.SupportedOrientations = DisplayOrientation.Portrait;

            maxHeight = 0;

            lives = 3;
            score = 0;

            Content.RootDirectory = "Content";
            IsMouseVisible = true;

            // Initialize the sound manager
            SoundManager.Initialize(this);

            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600;

            timerIncrease = 30;

            // Create the chase camera
            camera = new ChaseCamera();

            // Set the camera offsets
            camera.DesiredPositionOffset = new Vector3(0.0f, 2000.0f, 3500.0f);
            camera.LookAtOffset = new Vector3(0.0f, 150.0f, 0.0f);

            // Set camera perspective
            camera.NearPlaneDistance = 10.0f;
            camera.FarPlaneDistance = 10000000.0f;

            buildingDistance = 200000;
            //TODO: Set any other camera invariants here such as field of view

            // If you can't understand what this line means, you need lamped you dozy bastard
            _gameState = State.NewGame;
        }