Beispiel #1
0
        public void SetControlDirection(ControlDirection direction)
        {
            switch (direction)
            {
            case ControlDirection.Up: _virtualPadDirection.Z = _vpMoveSpeed; break;

            case ControlDirection.Down: _virtualPadDirection.Z = -_vpMoveSpeed; break;

            case ControlDirection.StrafeLeft: _virtualPadDirection.X = _vpStrafeSpeed; break;

            case ControlDirection.StrafeRight: _virtualPadDirection.X = -_vpStrafeSpeed; break;

            case ControlDirection.Left: Camera.RotateY(_vpRotateSpeed); break;

            case ControlDirection.Right: Camera.RotateY(-_vpRotateSpeed); break;

            default: break;
            }
        }
        private void Pad_Click(object sender, MouseClickEntityEventArgs e)
        {
            YnSprite button = sender as YnSprite;

            if (button != null)
            {
                string [] temp  = button.Name.Split(new char [] { '_' });
                int       index = int.Parse(temp [1].ToString());

                ControlDirection           direction = (ControlDirection)index;
                VirtualPadPressedEventArgs vpEvent   = new VirtualPadPressedEventArgs(direction);

                if (e.JustClicked)
                {
                    OnJustPressed(vpEvent);
                }
                else
                {
                    OnPressed(vpEvent);
                }
            }
        }
 public VirtualPadPressedEventArgs(ControlDirection direction)
 {
     Direction = direction;
 }
 public VirtualPadPressedEventArgs()
 {
     Direction = ControlDirection.None;
 }