Exemplo n.º 1
0
 /// <summary>
 /// Initializes MouseControl and stores CameraMan reference. 
 /// </summary>
 /// <param name="c">The reference to the game CameraMan.</param>
 /// <param name="sceneWidth">The width of the game window.</param>
 /// <param name="sceneHeight">The height of the game window.</param>
 /// <returns>Return initialized singleton instance.</returns>
 public static MouseControl GetInstance(CameraMan c, int sceneWidth, int sceneHeight)
 {
     if (instance == null) {
         instance = new MouseControl(c, sceneWidth, sceneHeight);
     }
     return instance;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes camera and cameraMan. Sets the near clip and far clip distance.
 /// </summary>
 protected override void CreateCamera()
 {
     mCamera = mSceneMgr.CreateCamera("myCam");
     mCamera.Position = cameraStart;
     mCamera.LookAt(Mogre.Vector3.ZERO);
     mCamera.NearClipDistance = 1;
     mCamera.FarClipDistance = 60000;
     mCameraMan = new Mogre.TutorialFramework.CameraMan(mCamera);
     cameraMan = mCameraMan;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes camera and cameraMan. Sets the near clip and far clip distance.
 /// </summary>
 protected override void CreateCamera()
 {
     mCamera          = mSceneMgr.CreateCamera("myCam");
     mCamera.Position = cameraStart;
     mCamera.LookAt(Mogre.Vector3.ZERO);
     mCamera.NearClipDistance = 1;
     mCamera.FarClipDistance  = 60000;
     mCameraMan = new Mogre.TutorialFramework.CameraMan(mCamera);
     cameraMan  = mCameraMan;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initialzes the Game.
 /// </summary>
 /// <param name="sceneManager">The Mogre SceneManager.</param>
 /// <param name="camera">The game CameraMan for the MouseControl.</param>
 /// <param name="mWindow">The RednerWindow for sending the width and height of the window.</param>
 /// <param name="mouse">The Mogre Mouse for GUI.</param>
 /// <param name="keyboard">The Mogre Keyboard for GUI.</param>
 /// <returns>Returns initializes Game singleton instance.</returns>
 private Game(SceneManager sceneManager, CameraMan camera, RenderWindow mWindow, Mouse mouse, Keyboard keyboard)
 {
     sceneMgr = sceneManager;
     gameObjectMgr = GameObjectManager.GetInstance();
     gameGUI = new MyGUI((int)mWindow.Width, (int)mWindow.Height, mouse, keyboard);
     mouseControl = MouseControl.GetInstance(camera, (int)mWindow.Width, (int)mWindow.Height);
     paused = true;
     soundPlayer = new SoundPlayer(mWindow);
     mission = new Mission();
 }
Exemplo n.º 5
0
        protected virtual void CreateCamera()
        {
            mCamera = mSceneMgr.CreateCamera("PlayerCam");

            mCamera.Position = new Vector3(0, 100, 250);

            mCamera.LookAt(new Vector3(0, 50, 0));
            mCamera.NearClipDistance = 5;

            mCameraMan = new CameraMan(mCamera);
        }
Exemplo n.º 6
0
        /// <summary>
        /// This method create a new camera
        /// </summary>
        protected override void CreateCamera()
        {
            //base.CreateCamera();
            #region Part 6
            mCamera = mSceneMgr.CreateCamera("PlayerCam");
            mCamera.Position = new Vector3(000, 100, 250);
            mCamera.LookAt(new Vector3(000, 000, 000));
            mCamera.NearClipDistance = 5;
            mCamera.FarClipDistance = 1000;
            mCamera.FOVy = new Degree(70);

            mCameraMan = new CameraMan(mCamera);
            mCameraMan.Freeze = true;
            #endregion
        }
Exemplo n.º 7
0
        /// <summary>
        /// Creates SelectionRectangle which is used for plane selects and registers it at SceneManager.
        /// Also sets the borders (for camera man movement borders).
        /// </summary>
        /// <param name="c">The reference to the game CameraMan.</param>
        /// <param name="sceneWidth">The width of the game window.</param>
        /// <param name="sceneHeight">The height of the game window.</param>
        private MouseControl(CameraMan c, int sceneWidth, int sceneHeight)
        {
            var stopBoundX = sceneHeight / 20;
            var stopBoundY = sceneWidth / 15;
            upBorder = sceneHeight / 6; ;
            upBorderStop = upBorder + stopBoundX;
            leftBorder = sceneWidth / 15;
            leftBorderStop = leftBorder + stopBoundY;
            rightBorder = sceneWidth - sceneWidth / 15;
            rightBorderStop = rightBorder - stopBoundY;
            bottomBorder = sceneHeight * 7 / 10;
            bottomBorderStop = bottomBorder - stopBoundX;

            cameraMan = c;
            mRect = new SelectionRectangle("RectangularSelect");
            Game.SceneManager.RootSceneNode.CreateChildSceneNode().AttachObject(mRect);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Creates SelectionRectangle which is used for plane selects and registers it at SceneManager.
        /// Also sets the borders (for camera man movement borders).
        /// </summary>
        /// <param name="c">The reference to the game CameraMan.</param>
        /// <param name="sceneWidth">The width of the game window.</param>
        /// <param name="sceneHeight">The height of the game window.</param>
        private MouseControl(CameraMan c, int sceneWidth, int sceneHeight)
        {
            var stopBoundX = sceneHeight / 20;
            var stopBoundY = sceneWidth / 15;

            upBorder         = sceneHeight / 6;;
            upBorderStop     = upBorder + stopBoundX;
            leftBorder       = sceneWidth / 15;
            leftBorderStop   = leftBorder + stopBoundY;
            rightBorder      = sceneWidth - sceneWidth / 15;
            rightBorderStop  = rightBorder - stopBoundY;
            bottomBorder     = sceneHeight * 7 / 10;
            bottomBorderStop = bottomBorder - stopBoundX;

            cameraMan = c;
            mRect     = new SelectionRectangle("RectangularSelect");
            Game.SceneManager.RootSceneNode.CreateChildSceneNode().AttachObject(mRect);
        }
Exemplo n.º 9
0
        protected virtual void CreateCamera()
        {
            mCamera = mSceneMgr.CreateCamera("PlayerCam");

            mCamera.Position = new Vector3(0, 100, 250);

            mCamera.LookAt(new Vector3(0, 50, 0));
            mCamera.NearClipDistance = 5;

            mCameraMan = new CameraMan(mCamera);
        }
Exemplo n.º 10
0
 /// <summary>
 /// If the game is not initializes,so creates GUI, MouseControl, GameObjectManager ,SoundPlayer and mission.
 /// Returns singleton instance.
 /// </summary>
 /// <param name="sceneManager">The Mogre SceneManager.</param>
 /// <param name="c">The game CameraMan for the MouseControl.</param>
 /// <param name="mWindow">The RednerWindow for sending the width and height of the window.</param>
 /// <param name="mouse">The Mogre Mouse for GUI.</param>
 /// <param name="keyboard">The Mogre Keyboard for GUI.</param>
 /// <returns>Returns initializes Game singleton instance.</returns>
 public static Game GetInstance(SceneManager sceneManager, CameraMan c, RenderWindow mWindow, Mouse mouse, Keyboard keyboard)
 {
     if (instance == null) {
         instance = new Game(sceneManager, c, mWindow, mouse, keyboard);
     }
     return instance;
 }