public void Update(GameTime gameTime, _Helicopter heli)
        {
            BoundingBox   bBox    = heli.GetBoundingBox();
            _MachineState state   = heli.GetMachineState();
            Vector3       heliPos = heli.Position;

            this.SetupView(this.position, this.target, this.up);
            this.SetupProjection();

            this.CameraRotation(gameTime);
            if (cameraMove == true)
            {
                this.CameraTranslation(gameTime);
            }

            this.view  = Matrix.Identity;
            this.view *= Matrix.CreateRotationX(MathHelper.ToRadians(rotation.X));
            this.view *= Matrix.CreateRotationY(MathHelper.ToRadians(rotation.Y));

            this.view *= Matrix.CreateTranslation(this.position);
            this.view  = Matrix.Invert(this.view);

            this.TranslateBoundingBox();

            if (this.boundingBox.Intersects(bBox))
            {
                if (state == _MachineState.On)
                {
                    cameraMove = false;

                    this.view *= Matrix.CreateRotationY(MathHelper.ToRadians(-180));
                    //this.view *= Matrix.CreateRotationX(MathHelper.ToRadians(10));
                }

                this.view *= Matrix.CreateTranslation(-heliPos);

                if (state == _MachineState.Off && cameraMove == false)
                {
                    Console.WriteLine("Saiu");
                    this.position = this.position + new Vector3(0, 30, 55);
                    this.view    *= Matrix.CreateRotationY(MathHelper.ToRadians(-180));
                    this.view    *= Matrix.CreateRotationX(MathHelper.ToRadians(10));
                    cameraMove    = true;
                }
            }

            //Console.WriteLine("BoxC: " + this.boundingBox.ToString());
            //Console.WriteLine("BoxH: " + bBox.ToString());
            //Console.WriteLine("State: " + state.ToString());
        }
Example #2
0
        protected override void Initialize()
        {
            this.world  = Matrix.Identity;
            this.screen = _Screen.GetInstance();
            this.screen.SetWidth(graphics.PreferredBackBufferWidth);
            this.screen.SetHeight(graphics.PreferredBackBufferHeight);

            this.camera = new _Camera();

            this.ground = new _Quad(GraphicsDevice, this, Color.SaddleBrown, new Vector3(0, 0, 0), new Vector2(120, 120), _WallOrientation.Up);

            this.house = new _House(GraphicsDevice, this);

            this.helicopter = new _Helicopter(GraphicsDevice, this);

            base.Initialize();
        }
        protected override void Initialize()
        {
            this.world  = Matrix.Identity;
            this.screen = _Screen.GetInstance();
            this.screen.SetWidth(graphics.PreferredBackBufferWidth);
            this.screen.SetHeight(graphics.PreferredBackBufferHeight);

            this.camera = new _Camera();

            this.ground = new _Quad(GraphicsDevice, this, @"Textures\ground", @"Textures\groundSnow", new Vector3(0, 0, 0), new Vector2(500, 500), _WallOrientation.Up);

            this.house = new _House(GraphicsDevice, this);

            this.helicopter = new _Helicopter(GraphicsDevice, this);

            this.highMap = new _HM(this, GraphicsDevice);

            base.Initialize();
        }