예제 #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            float speed = (float)1;

            if (moveRight)
            {
                camera.MoveRight(speed);
            }
            if (moveLeft)
            {
                camera.MoveRight(-speed);
            }
            if (moveForward)
            {
                if (!camera.IsOrthographic)
                {
                    camera.MoveForward(speed);
                }
                else
                {
                    camera.Zoom -= 5;
                }
            }
            if (moveBackward)
            {
                if (!camera.IsOrthographic)
                {
                    camera.MoveForward(-speed);
                }
                else
                {
                    camera.Zoom += 5;
                }
            }
            if (mouseMoving)
            {
                if (mouseEventArgs != null && mouseEventArgs.X == tempMouseX && mouseEventArgs.Y == tempMouseY)
                {
                    mouseMoving    = false;
                    mouseEventArgs = null;
                    tempMouseX     = tempMouseY = -1;
                    timer1.Enabled = false;
                    camera.Notify();
                }
                else
                {
                    editorMode.MouseMove(sender, mouseEventArgs);

                    if (mouseEventArgs != null)
                    {
                        tempMouseX = mouseEventArgs.X;
                        tempMouseY = mouseEventArgs.Y;
                    }
                }
            }
            if (easeRemain > 0)
            {
                if (easeAngularSpeed == Vector3.Zero)
                {
                    camera.Move(easeSpeed);
                }
                else
                {
                    camera.Move(easeSpeed, easeAngularSpeed);
                }
                easeRemain--;
                if (easeRemain == 0)
                {
                    easeRemain      = 0;
                    timer1.Enabled  = false;
                    camera.IsMoving = false;
                }
                else
                {
                    timer1.Enabled = true;
                }
            }
            //if (moveRight || moveLeft || moveForward || moveBackward || easeRemain > 0)
            camera.Notify();
        }