void VRage.Game.ModAPI.Interfaces.IMyControllableEntity.DrawHud(IMyCameraController camera, long playerId)
 {
     if (camera != null)
     {
         DrawHud(camera, playerId);
     }
 }
        public override void UpdateBeforeSimulation()
        {
            if (IsCutsceneRunning)
            {
                if (MySession.Static.CameraController != m_cameraEntity)
                {
                    m_originalCameraController = MySession.Static.CameraController;
                    MySession.Static.SetCameraController(MyCameraControllerEnum.Entity, m_cameraEntity);
                }
                if (m_currentCutscene.SequenceNodes != null && m_currentCutscene.SequenceNodes.Length > m_currentNodeIndex)
                {
                    m_currentNode = m_currentCutscene.SequenceNodes[m_currentNodeIndex];
                    CutsceneUpdate();
                }
                else
                {
                    //cutscene done
                    if (m_currentCutscene.NextCutscene != null && m_currentCutscene.NextCutscene.Length > 0)
                        PlayCutscene(m_currentCutscene.NextCutscene);
                    else
                        CutsceneEnd();
                }
                m_cameraEntity.WorldMatrix = m_currentCameraMatrix;

                /*
                 * DEBUG curve
                if (false && m_waypoints.Count > 2)
                {
                    int i = 0;
                    for (float timeRatio = 0f; timeRatio <= 1f; timeRatio += 0.01f)
                    {
                        float segmentTime = 1f / (m_waypoints.Count - 1);
                        int segment = (int)Math.Floor(timeRatio / segmentTime);
                        float segmentRatio = (timeRatio - segment * segmentTime) / segmentTime;
                        Vector3D pos = Vector3D.Zero;
                        if (segment == 0)
                        {
                            pos = MathHelper.CalculateBezierPoint(segmentRatio, m_waypoints[segment], m_waypoints[segment], m_waypoints[segment + 1] - (m_waypoints[segment + 2] - m_waypoints[segment]) / 4, m_waypoints[segment + 1]);
                        }
                        else if (segment >= m_waypoints.Count - 2)
                        {
                            pos = MathHelper.CalculateBezierPoint(segmentRatio, m_waypoints[segment], m_waypoints[segment] + (m_waypoints[segment + 1] - m_waypoints[segment - 1]) / 4, m_waypoints[segment + 1], m_waypoints[segment + 1]);
                        }
                        else
                        {
                            pos = MathHelper.CalculateBezierPoint(segmentRatio, m_waypoints[segment], m_waypoints[segment] + (m_waypoints[segment + 1] - m_waypoints[segment - 1]) / 4, m_waypoints[segment+1] - (m_waypoints[segment + 2] - m_waypoints[segment]) / 4, m_waypoints[segment + 1]);
                        }
                        //VRageRender.MyRenderProxy.DebugDrawSphere((Vector3)pos, 0.2f, Color.Aquamarine, 1f, true);
                        VRageRender.MyRenderProxy.DebugDrawText3D(pos, i.ToString(), Color.GreenYellow, 1, true);
                        i++;
                    }
                    foreach(var w in m_waypoints)
                        VRageRender.MyRenderProxy.DebugDrawSphere(w, 1.5f, Color.Orange, 1f, true);
                }*/
            }
        }
        public void DrawHud(IMyCameraController camera, long playerId)
        {
            MyHud.Crosshair.Recenter();

            if (m_currentWeapon != null)
            {
                m_currentWeapon.DrawHud(camera, playerId);
            }
        }
        public void OnAssumeControl(IMyCameraController previousCameraController)
        {
            //if (Parent is MyCockpit)
            //{
            //    var cockpit = Parent as MyCockpit;
            //    if (cockpit.Pilot == this)
            //    {
            //        MySession.Static.SetCameraController(MyCameraControllerEnum.Entity, cockpit);
            //    }

            //    return;
            //}
        }
Пример #5
0
 public void OnReleaseControl(IMyCameraController newCameraController)
 {
     //IsInFirstPersonView = false; //AB: Why this?
 }
Пример #6
0
        void Static_CameraAttachedToChanged(IMyCameraController oldController, IMyCameraController newController)
        {
            if (MySession.ControlledEntity == this && newController != MyThirdPersonSpectator.Static && newController != this)
            {
                EndShootAll();
            }

            UpdateCameraAfterChange();
        }
 public void OnAssumeControl(IMyCameraController previousCameraController)
 {
 }
 void IMyCameraController.OnReleaseControl(IMyCameraController newCameraController)
 {
     OnReleaseControl(newCameraController);
 }
 // ------------------------------------------------------------------------------------------------
 public void OnReleaseControl(IMyCameraController newCameraController)
 {
     TurnLightOff();
 }
Пример #10
0
 public void OnAssumeControl(IMyCameraController previousCameraController)
 {
     UpdateCameraAfterChange();
 }
        public bool PlayCutscene(string cutsceneName)
        {
            MySandboxGame.Log.WriteLineAndConsole("Cutscene start: " + cutsceneName);
            if (m_cutsceneLibrary.ContainsKey(cutsceneName))
            {
                if (IsCutsceneRunning)
                    CutsceneEnd(false);
                else
                    m_origHud = MyHud.MinimalHud;

                m_currentCutscene = m_cutsceneLibrary[cutsceneName];
                m_currentNode = null;
                m_currentNodeIndex = 0;
                m_currentTime = 0;
                m_nodeActivated = false;
                m_lookTarget = null;
                m_attachedPositionTo = null;
                m_attachedRotationTo = null;
                m_rotateTarget = null;
                m_moveTarget = null;
                m_currentFOV = MathHelper.Clamp(m_currentCutscene.StartingFOV, MINIMUM_FOV, MAXIMUM_FOV);
                MyGuiScreenGamePlay.DisableInput = true;
                if (MyCubeBuilder.Static.IsActivated)
                    MyCubeBuilder.Static.Deactivate();
                MyHud.MinimalHud = true;

                MatrixD startMatrix = MatrixD.Identity;
                MyEntity entity = m_currentCutscene.StartEntity.Length > 0 ? MyVisualScriptLogicProvider.GetEntityByName(m_currentCutscene.StartEntity) : null;
                if (entity != null)
                    startMatrix = entity.WorldMatrix;

                if (m_currentCutscene.StartLookAt.Length > 0 && !m_currentCutscene.StartLookAt.Equals(m_currentCutscene.StartEntity))
                {
                    entity = MyVisualScriptLogicProvider.GetEntityByName(m_currentCutscene.StartLookAt);
                    if (entity != null)
                        startMatrix = MatrixD.CreateLookAtInverse(startMatrix.Translation, entity.PositionComp.GetPosition(), startMatrix.Up);
                }
                m_nodeStartMatrix = startMatrix;
                m_currentCameraMatrix = startMatrix;
                m_originalCameraController = MySession.Static.CameraController;
                m_cameraEntity.WorldMatrix = startMatrix;
                MySession.Static.SetCameraController(MyCameraControllerEnum.Entity, m_cameraEntity);

                return true;
            }
            else
            {
                Debug.Fail("There is no cutscene named \"" + cutsceneName + "\".");
                return false;
            }
        }
Пример #12
0
 void IMyCameraController.OnAssumeControl(IMyCameraController previousCameraController)
 {
     OnAssumeControl(previousCameraController);
 }
 // ------------------------------------------------------------------------------------------------
 void IMyCameraController.OnReleaseControl(IMyCameraController newCameraController)
 {
     OnReleaseControl(newCameraController);
 }
 // ------------------------------------------------------------------------------------------------
 void IMyCameraController.OnAssumeControl(IMyCameraController previousCameraController)
 {
     OnAssumeControl(previousCameraController);
 }
 // ------------------------------------------------------------------------------------------------
 public void OnReleaseControl(IMyCameraController newCameraController)
 {
     TurnLightOff();
 }
 // ------------------------------------------------------------------------------------------------
 public void OnAssumeControl(IMyCameraController previousCameraController)
 {
 }
Пример #17
0
 public void DrawHud(IMyCameraController camera, long playerId)
 {
 }
Пример #18
0
 public void DrawHud(IMyCameraController camera, long playerId)
 {
     MyHud.Crosshair.Position = MyHudCrosshair.ScreenCenter;
 }
 void VRage.Game.ModAPI.Interfaces.IMyControllableEntity.DrawHud(IMyCameraController entity, long player)
 {
     if(entity is IMyCameraController)
         DrawHud(entity as IMyCameraController, player);
 }
Пример #20
0
 void IMyCameraController.OnReleaseControl(IMyCameraController newCameraController)
 {
     OnReleaseControl(newCameraController);
     if (Pilot != null && Pilot.InScene)
         Pilot.EnableHead(true);
 }
Пример #21
0
        public void OnAssumeControl(IMyCameraController previousCameraController)
        {
            if (Parent is MyCockpit)
            {
                var cockpit = Parent as MyCockpit;
                if (cockpit.Pilot == this)
                {
                    MySession.Static.SetCameraController(MyCameraControllerEnum.Entity, cockpit);
                }

                return;
            }
        }
Пример #22
0
 public void OnReleaseControl(IMyCameraController newCameraController)
 {
     UpdateNearFlag();
     if (m_enableFirstPerson)
     {
         UpdateCockpitModel();
         UpdateCockpitGlass();
     }
 }
        public void ResetCamera()
        {
            ResetCurrentCamera();
            //Can be null when closing the game
            bool switched = false;
            if (PreviousNonCameraBlockController != null)
            {
                MyEntity entity = PreviousNonCameraBlockController as MyEntity;
                if (entity != null && !entity.Closed)
                {
                    MySession.Static.SetCameraController(MyCameraControllerEnum.Entity, entity);
                    PreviousNonCameraBlockController = null;
                    switched = true;
                }
            }

            if (!switched && MySession.Static.LocalCharacter != null)
            {
                MySession.Static.SetCameraController(MyCameraControllerEnum.Entity, MySession.Static.LocalCharacter);
            }
            DisableCameraEffects();
        }
 public void OnReleaseControl(IMyCameraController newCameraController)
 {
 }
Пример #25
0
 public void CameraAttachedToChanged(IMyCameraController oldController, IMyCameraController newController)
 {
     if (oldController == this)
     {
         MyHudCameraOverlay.Enabled = false;
         MyRenderProxy.UpdateRenderObjectVisibility(Render.RenderObjectIDs[0], true, false);
     }
     else if (newController == this)
     {
         SetOverlay();
         MyRenderProxy.UpdateRenderObjectVisibility(Render.RenderObjectIDs[0], false, false);
     }
 }
 internal void DrawHud(IMyCameraController camera, long playerId)
 {
     if (m_currentGuns != null)
     {
         foreach (var gun in m_currentGuns)
         {
             gun.DrawHud(camera, playerId);
         }
     }
 }
        void IMyCameraController.OnAssumeControl(IMyCameraController previousCameraController)
        {
            if (!(previousCameraController is MyCameraBlock))
                MyGridCameraSystem.PreviousNonCameraBlockController = previousCameraController;

            OnAssumeControl(previousCameraController);
        }
        public void DrawHud(IMyCameraController camera, long playerId)
        {
            MyGunStatusEnum status;
            CanShoot(MyShootActionEnum.PrimaryAction, playerId, out status);

            if (status == MyGunStatusEnum.OK || status == MyGunStatusEnum.Cooldown)
            {
                var matrix = m_gunBase.GetMuzzleWorldMatrix();
                var from = matrix.Translation;
                var to = from + 50 * matrix.Forward;

                Vector3D target = Vector3D.Zero;
                if (MyHudCrosshair.GetTarget(from, to, ref target))
                {
                    float distance = (float)Vector3D.Distance(MySector.MainCamera.Position, target);

                    MyTransparentGeometry.AddBillboardOriented(
                        "RedDot",
                        Vector4.One,
                        target,
                        MySector.MainCamera.LeftVector,
                        MySector.MainCamera.UpVector,
                          distance / 300.0f);
                }
            }
        }
Пример #29
0
        public void DrawHud(IMyCameraController camera, long playerId)
        {
 
        }
Пример #30
0
        public void DrawHud(IMyCameraController camera, long playerId)
        {
            if (GridSelectionSystem != null)
                GridSelectionSystem.DrawHud(camera, playerId);

            var to = PositionComp.GetPosition() + 1000 * PositionComp.WorldMatrix.Forward;

            Vector2 target = Vector2.Zero;
            if (MyHudCrosshair.GetProjectedVector(to, ref target))
            {
                MyHud.Crosshair.Position = target;
            }
        }
Пример #31
0
        public void DrawHud(IMyCameraController camera, long playerId)
        {
            if (GridSelectionSystem != null)
                GridSelectionSystem.DrawHud(camera, playerId);

            var to = PositionComp.GetPosition() + 1000 * PositionComp.WorldMatrix.Forward;

            Vector2 target = Vector2.Zero;
            if (MyHudCrosshair.GetProjectedVector(to, ref target))
            {
                if (BuildingMode)
                    target.Y += 0.17f * MyGuiManager.GetHudSize().Y;
                MyHud.Crosshair.ChangePosition(target);
            }

            if (raycaster != null && raycaster.HitBlock != null)
            {

                MyHud.BlockInfo.Visible = true;

                MyHud.BlockInfo.MissingComponentIndex = -1;
                MyHud.BlockInfo.BlockName = raycaster.HitBlock.BlockDefinition.DisplayNameText;
                MyHud.BlockInfo.BlockIcons = raycaster.HitBlock.BlockDefinition.Icons;
                MyHud.BlockInfo.BlockIntegrity = raycaster.HitBlock.Integrity / raycaster.HitBlock.MaxIntegrity;
                MyHud.BlockInfo.CriticalIntegrity = raycaster.HitBlock.BlockDefinition.CriticalIntegrityRatio;
                MyHud.BlockInfo.CriticalComponentIndex = raycaster.HitBlock.BlockDefinition.CriticalGroup;
                MyHud.BlockInfo.OwnershipIntegrity = raycaster.HitBlock.BlockDefinition.OwnershipIntegrityRatio;

                MySlimBlock.SetBlockComponents(MyHud.BlockInfo, raycaster.HitBlock);
            }

        }
Пример #32
0
        void Static_CameraAttachedToChanged(IMyCameraController oldController, IMyCameraController newController)
        {
            if (oldController != newController && MySession.Static.ControlledEntity == this && newController != this)
            {
                ResetMovement();
                EndShootAll();
            }

            UpdateNearFlag();

            if (!Render.NearFlag && MySector.MainCamera != null) // During unload, camera is null?
            //MySector.MainCamera.Zoom.ResetZoom();
            {
                if (m_zoomMode == MyZoomModeEnum.IronSight)
                    EnableIronsight(false, true, false);
            }
            else
            {
                if (oldController != newController)
                {
                    ResetHeadRotation();
                }
            }
        }
 public void CameraAttachedToChanged(IMyCameraController oldController, IMyCameraController newController)
 {
     if (oldController == this)
     {
         MyRenderProxy.UpdateRenderObjectVisibility(Render.RenderObjectIDs[0], true, false);
     }
 }
Пример #34
0
 public void OnReleaseControl(IMyCameraController newCameraController)
 {
     IsInFirstPersonView = false;
 }
Пример #35
0
        public void OnReleaseControl(IMyCameraController newCameraController)
        {
            UpdateNearFlag();
            if (m_enableFirstPerson)
            {
                UpdateCockpitModel();
                UpdateCockpitGlass();

                if (Pilot != null)
                    Pilot.EnableHead(!Render.NearFlag);
            }
        }
Пример #36
0
 void IMyCameraController.OnReleaseControl(IMyCameraController newCameraController)
 {
     OnReleaseControl(newCameraController);
     if (InScene)
         EnableHead(true);
 }
Пример #37
0
 public void OnReleaseControl(IMyCameraController newCameraController)
 {
 }