Пример #1
0
 public static void ManageMini(Camera minimapC, Plane playerPlane, FrameEvent evt)
 {
     // ruch kamery na minimapy
     if (EngineConfig.DisplayingMinimap)
     {
         Vector2 v             = UnitConverter.LogicToWorldUnits(playerPlane.Position);
         Vector3 minimapCamPos = minimapC.Position;
         minimapCamPos.x = v.x; // przesuwamy tylko X
         minimapC.SetPosition(minimapCamPos.x, minimapCamPos.y, minimapCamPos.z);
     }
 }
Пример #2
0
        public PlaneView(Plane plane, IFrameWork frameWork, SceneNode parentNode, String name)
        {
            this.frameWork  = frameWork;
            this.sceneMgr   = frameWork.SceneMgr;
            this.plane      = plane;
            this.parentNode = parentNode;
            this.name       = name;

            planeNode         = parentNode.CreateChildSceneNode(name);
            outerSteeringNode = planeNode.CreateChildSceneNode(name + "OuterSteeringNode");
            innerSteeringNode = outerSteeringNode.CreateChildSceneNode(name + "InnerSteeringNode");

            outerNode = innerSteeringNode.CreateChildSceneNode(name + "OuterNode");

            idleNode = outerNode.CreateChildSceneNode(name + "IdleNode");

            innerNode = idleNode.CreateChildSceneNode(name + "InnerNode");
            initSmokeSystems();
            cameraHolders = new List <SceneNode>();
            initOnScene();
        }
Пример #3
0
        public void HandleCameraInput(Keyboard inputKeyboard, Mouse inputMouse, IList <JoyStick> inputJoysticks, FrameEvent evt, Camera camera, Camera minimapCamera, Plane playerPlane)
        {
            // Move about 100 units per second,
            float moveScale = camSpeed * evt.timeSinceLastFrame;
            // Take about 10 seconds for full rotation

            Vector3 translateVector = Vector3.ZERO;

            // set the scaling of camera motion



            if (camera != null)
            {
                if (inputKeyboard.IsKeyDown(KeyCode.KC_A))
                {
                    if (inputKeyboard.IsKeyDown(KeyCode.KC_LSHIFT))
                    {
                        translateVector.x = -3 * moveScale;
                    }
                    else
                    {
                        translateVector.x = -moveScale;
                    }
                }

                if (inputKeyboard.IsKeyDown(KeyCode.KC_D))
                {
                    if (inputKeyboard.IsKeyDown(KeyCode.KC_LSHIFT))
                    {
                        translateVector.x = 3 * moveScale;
                    }
                    else
                    {
                        translateVector.x = moveScale;
                    }
                }

                if (inputKeyboard.IsKeyDown(KeyCode.KC_W))
                {
                    if (inputKeyboard.IsKeyDown(KeyCode.KC_LSHIFT))
                    {
                        translateVector.z = -3 * moveScale;
                    }
                    else
                    {
                        translateVector.z = -moveScale;
                    }
                }

                if (inputKeyboard.IsKeyDown(KeyCode.KC_S))
                {
                    if (inputKeyboard.IsKeyDown(KeyCode.KC_LSHIFT))
                    {
                        translateVector.z = 3 * moveScale;
                    }
                    else
                    {
                        translateVector.z = moveScale;
                    }
                }

                if (mouseButtons == MouseButtons.Left)
                {
                    Degree cameraYaw   = -mouseDiff.x * .13f;
                    Degree cameraPitch = -mouseDiff.y * .13f;

                    camera.Yaw(cameraYaw);
                    camera.Pitch(cameraPitch);
                }


                // ZOOM IN
                if (mousePos.z > 0)
                {
                    translateVector.z -= moveScale * 0.1f * mousePos.z;
                    //camera.Position += new Vector3(0, 0, -mouseDiff.z * .05f);
                }

                // ZOOM OUT
                if (mousePos.z < 0)
                {
                    translateVector.z -= moveScale * 0.1f * mousePos.z;
                    // camera.Position += new Vector3(0, 0, -mouseDiff.z * .05f);
                }

                camera.MoveRelative(translateVector);
            }
        }
Пример #4
0
 public void SetListener(CameraListenerBase listener, Wof.Model.Level.Planes.Plane plane)
 {
     _listener = listener;
     _plane    = plane;
 }
Пример #5
0
 public void SetListener(CameraListenerBase listener, Wof.Model.Level.Planes.Plane plane)
 {
     _listener = new FSLListener(listener, plane);
 }
Пример #6
0
 public void SetUserPlane(Wof.Model.Level.Planes.Plane plane)
 {
     SetListener(_listener.Listener, plane);
 }
Пример #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="c">Kamera g³ówna</param>
        /// <param name="playerPlane">Obiekt samolotu gracza (model)</param>
        /// <param name="evt">FrameEvent (chodzi o czas od ostatniej klatki)</param>
        /// <param name="manualZoom"></param>
        /// <returns></returns>
        public static void Manage(Camera c, Plane playerPlane, FrameEvent evt, float manualZoom)
        {
            Plane p = null;

            if (playerPlane != null)
            {
                p = playerPlane;
            }
            Vector3 translateVector = Vector3.ZERO;

            float t = evt.timeSinceLastFrame;

            if (t >= 1.0f)
            {
                t = 0.99f;
            }

            float minCamDistance = 15;
            float halfMaxHeight  = (float)GameConsts.GenericPlane.CurrentUserPlane.MaxHeight / 2.0f;

            float realHalfMaxHeight = halfMaxHeight * 0.95f;
            float camAlt            = c.RealPosition.y + c.Position.y;
            // float camAlt = c.RealPosition.y;

            float minCamAlt = 4.0f;


            /* bool duringEmergency = false;
             *
             * // awaryjne wynurzenie kamery;)
             * if (c._getDerivedPosition().y + c.Position.y <= 0)
             * {
             *   // metr nad wod¹
             *   Vector3 emergency = new Vector3(0, c.Position.y + c._getDerivedPosition().y + 1.0f, 0);
             *   c.MoveRelative(emergency);
             *   duringEmergency = true;
             * }*/


            // wysokosc
            if (camAlt < minCamAlt)
            {
                translateVector.y = 40 * (minCamAlt - camAlt); // wynurzenie kamery znad powierchni wody
            }
            else if (camAlt > 10)
            {
                // powrot w ozi Y
                if (c.Position.y > 0.01f && EngineConfig.CurrentGameSpeedMultiplier != EngineConfig.GameSpeedMultiplierSlow)
                {
                    translateVector.y = -(c.Position.y) / 10.0f;
                }
            }


            // ZOOMING
            float speed       = (float)p.Speed;
            float speedFactor = 0;
            float altFactor   = 0;

            // wspolczynnik wysokosci
            if (c.RealPosition.y > 0)
            {
                altFactor = (float)Math.Log(c.RealPosition.y + 1, 1.011);
                altFactor = Math.Max(0, altFactor);
            }
            float zoomFactor;

            speedFactor = speed; // wsp. szybkosci

            //altFactor*=altFactor * altFactor;
            if (playerPlane.Position.Y < 30)
            {
                altFactor /= (30 - (float)playerPlane.Position.Y) * 0.15f;
            }
            if (altFactor > 250)
            {
                altFactor = 250;
            }
            zoomFactor = speedFactor * 0.1f + altFactor * 0.53f + (-manualZoom + minCamDistance - c.Position.z);

            // Bullet-time
            if (EngineConfig.CurrentGameSpeedMultiplier == EngineConfig.GameSpeedMultiplierSlow)
            {
                zoomFactor += -manualZoom + minCamDistance - c.Position.z + 30.0f;
            }

            translateVector.z += zoomFactor;



            // ruch kamery w zaleznosci od wysokosci
            if (c.RealPosition.y >= realHalfMaxHeight && EngineConfig.CurrentGameSpeedMultiplier != EngineConfig.GameSpeedMultiplierSlow)
            {
                translateVector.y -= (camAlt - realHalfMaxHeight);
            }
            else if (c.RealPosition.y < (realHalfMaxHeight * 0.75f))
            {
                if (c.Position.y < 0)
                {
                    translateVector.y -= c.Position.y;
                }
            }



            // ograniczenia awaryjne
            // translateVector.z += manualZoom;

            translateVector.x = Math.Min(translateVector.x, 500);
            translateVector.y = Math.Min(translateVector.y, 500);
            translateVector.z = Math.Min(translateVector.z, 500);

            translateVector.x = Math.Max(translateVector.x, -500);
            translateVector.y = Math.Max(translateVector.y, -500);
            translateVector.z = Math.Max(translateVector.z, -500);


            // uzaleznij od czasu
            translateVector *= t;
            c.MoveRelative(translateVector);
        }
Пример #8
0
 public EnemyPlaneViewBase(Plane plane, IFrameWork frameWork, SceneNode parentNode, String name)
     : base(plane, frameWork, parentNode, name)
 {
 }
Пример #9
0
 /// <summary>
 /// Samolot gracza w widoku
 /// <author>Adam Witczak,Kamil S³awiñski</author>
 /// </summary>
 public PlayerPlaneView(Plane plane, IFrameWork frameWork, SceneNode parentNode)
     : base(plane, frameWork, parentNode, "Plane_" + (plane != null ? plane.PlaneType.ToString() : "Modelless") + planeCounter)
 {
     planeCounter++;
 }