CameraLookAt() public method

public CameraLookAt ( IntVector3 p ) : void
p IntVector3
return void
Example #1
0
        void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (this.KeyDown != null)
            {
                this.KeyDown(e);

                if (e.Handled)
                {
                    return;
                }
            }

            var controlMode = m_control.Config.CameraControlMode;

            if (controlMode == CameraControlMode.None)
            {
                return;
            }

            Key key = e.Key;

            if (key == Key.System || key == Key.Tab)
            {
                return;
            }

            var  viewGrid = m_game.ViewGridProvider;
            bool ctrl     = (e.KeyboardDevice.Modifiers & ModifierKeys.Control) != 0;

            e.Handled = true;

            switch (key)
            {
            case Key.NumPad4:
                if (!ctrl)
                {
                    viewGrid.ViewCorner1 += Direction.West;
                }
                else
                {
                    viewGrid.ViewCorner2 += Direction.West;
                }
                return;

            case Key.NumPad6:
                if (!ctrl)
                {
                    viewGrid.ViewCorner1 += Direction.East;
                }
                else
                {
                    viewGrid.ViewCorner2 += Direction.East;
                }
                return;

            case Key.NumPad8:
                if (!ctrl)
                {
                    viewGrid.ViewCorner1 += Direction.North;
                }
                else
                {
                    viewGrid.ViewCorner2 += Direction.North;
                }
                return;

            case Key.NumPad2:
                if (!ctrl)
                {
                    viewGrid.ViewCorner1 += Direction.South;
                }
                else
                {
                    viewGrid.ViewCorner2 += Direction.South;
                }
                return;

            case Key.NumPad5:
                viewGrid.ResetGrid();
                return;

            case Key.Home:
                var ob = m_game.Environment.World.Controllables.FirstOrDefault();
                if (ob != null)
                {
                    m_game.CameraLookAt(ob.Location);
                }
                return;

            default:
                e.Handled = false;
                break;
            }

            m_keysDown.Add(key);

            // mark the keys as handled which have side effects (moving focus etc)
            HandleRtsFspKeyHandled(e);
        }
Example #2
0
 public void CameraLookAt(EnvironmentObject env, IntVector3 p)
 {
     this.Environment = env;
     m_game.CameraLookAt(p);
 }