Example #1
0
        private void CameraLoading()
        {
            cameraRotationAxle = new Axle
            {
                firstPoint = new Models.Point()
                {
                    X = 683,
                    Y = 0,
                    Z = -1000
                },
                secondPoint = new Models.Point()
                {
                    X = 683,
                    Y = 384,
                    Z = -1000
                }
            };
            cameraPosition = new Models.Point()
            {
                X = 683,
                Y = 200,
                Z = 00
            };

            cameraMovementMatrix = Matrix.Movement(new Models.Point()
            {
                X = cameraPosition.X - 683,
                Y = cameraPosition.Y - 384,
                Z = -cameraPosition.Z
            });
            cameraPerspectiveMatrix = Matrix.CameraPerspective(new Models.Point()
            {
                X = 683,
                Y = 384,
                Z = 1000
            });
            cameraRotationMatrix = Matrix.Rotation(cameraRotationAxle, cameraRotationAngle);
        }
Example #2
0
        public void Shooting()
        {
            if (gunShooting)
            {
                if (gunPosition > 14)
                {
                    gunShooting = false;
                }
                else
                {
                    var gunCar = car["gun"];
                    var zAxlePoint = gunCar.axles.Z.firstPoint;
                    var centerPoint = gunCar.GetCenter();
                    var vectorPoint = new Models.Point()
                    {
                        X = (centerPoint.X - zAxlePoint.X) / 5,
                        Y = (centerPoint.Y - zAxlePoint.Y) / 5,
                        Z = (centerPoint.Z - zAxlePoint.Z) / 5
                    };

                    var gunMatrix = Matrix.Movement(vectorPoint);
                    gunCar.EmbedMatrix(gunMatrix);

                    var gunAbrams = abrams["turret"]["gun"];
                    zAxlePoint = gunAbrams.axles.Z.firstPoint;
                    centerPoint = gunAbrams.GetCenter();
                    vectorPoint = new Models.Point()
                    {
                        X = (centerPoint.X - zAxlePoint.X) / 15,
                        Y = (centerPoint.Y - zAxlePoint.Y) / 15,
                        Z = (centerPoint.Z - zAxlePoint.Z) / 15
                    };

                    gunMatrix = Matrix.Movement(vectorPoint);
                    gunAbrams.EmbedMatrix(gunMatrix);
                    gunPosition += 2;
                }
            }
            else
            {
                if (gunPosition > 0)
                {
                    var gunCar = car["gun"];
                    var zAxlePoint = gunCar.axles.Z.firstPoint;
                    var centerPoint = gunCar.GetCenter();
                    var vectorPoint = new Models.Point()
                    {
                        X = (centerPoint.X - zAxlePoint.X) / -10,
                        Y = (centerPoint.Y - zAxlePoint.Y) / -10,
                        Z = (centerPoint.Z - zAxlePoint.Z) / -10
                    };

                    var gunMatrix = Matrix.Movement(vectorPoint);
                    gunCar.EmbedMatrix(gunMatrix);

                    var gunAbrams = abrams["turret"]["gun"];
                    zAxlePoint = gunAbrams.axles.Z.firstPoint;
                    centerPoint = gunAbrams.GetCenter();
                    vectorPoint = new Models.Point()
                    {
                        X = (centerPoint.X - zAxlePoint.X) / -30,
                        Y = (centerPoint.Y - zAxlePoint.Y) / -30,
                        Z = (centerPoint.Z - zAxlePoint.Z) / -30
                    };

                    gunMatrix = Matrix.Movement(vectorPoint);

                    gunAbrams.EmbedMatrix(gunMatrix);
                    gunPosition--;
                }
            }
        }