예제 #1
0
 public override void UpdateHudMarker(bool enableReset = false)
 {
     if (MyMissions.IsMissionEntity(this))
     {
         base.SetHudMarker();
     }
     else
     {
         MyHud.RemoveText(this);
     }
 }
예제 #2
0
 public void SetLocationVisibility(bool visible, MyEntity entity, MyGuitargetMode guiTargetMode)
 {
     if (visible)
     {
         MyHud.RemoveText(entity);
         MyHud.AddText(entity, HudNameTemp ?? NameTemp, guiTargetMode);
     }
     else
     {
         entity.UpdateHudMarker(true);
     }
 }
예제 #3
0
        public static MyEntity SwitchNextTarget(bool forward)
        {
            MyEntity newTarget = null;

            m_targets.Clear();
            m_targets.AddRange(MyHud.GetHudEnemiesOnScreen());

            bool needActualizeIndex = NeedActualizeIndex();

            int targetsLeft = m_targets.Count;

            while (targetsLeft > 0)
            {
                if (needActualizeIndex)
                {
                    m_currentIndex         = 0;
                    m_lastOwnerWorldMatrix = m_owner.WorldMatrix;
                    needActualizeIndex     = false;
                }
                else
                {
                    m_currentIndex += forward ? 1 : -1;
                }

                if (m_currentIndex >= m_targets.Count)
                {
                    m_currentIndex = 0;
                }
                if (m_currentIndex < 0)
                {
                    m_currentIndex = m_targets.Count - 1;
                }
                if (CanSee(m_owner, m_targets[m_currentIndex]) == null)
                {
                    newTarget = m_targets[m_currentIndex];
                    break;
                }
                targetsLeft--;
            }
            m_lastTimeTargeting = MyMinerGame.TotalTimeInMilliseconds;

            if (m_owner is MySmallShip)
            {
                (m_owner as MySmallShip).TargetEntity = newTarget;
            }

            m_currentTarget = newTarget;
            return(m_currentTarget);
        }
예제 #4
0
        public override void OnPlayerJoined(Player player)
        {
            base.OnPlayerJoined(player);

            _players.Add(player);

            MyHud.BroadcastMessage($"{player.Name} has joined.");

            if (Authority)
            {
                player.Team = (Phase == Phase.Prep) ? (int)Team.Terror : (int)Team.Spectator;

                RespawnPlayer(player);
            }
        }
예제 #5
0
        private void AddLabelToCurrentCheckPoint()
        {
            string label = (m_currentCheckPointIndex + 1).ToString(CultureInfo.InvariantCulture) + "/" +
                           m_raceLocations.Count.ToString(CultureInfo.InvariantCulture);

            m_raceLocations[m_currentCheckPointIndex].Entity =
                MyScriptWrapper.GetEntity(m_raceLocations[m_currentCheckPointIndex].LocationEntityIdentifier);
            SetLocationVisibility(true, m_raceLocations[m_currentCheckPointIndex].Entity, MyGuitargetMode.Objective);
            MyHudIndicatorFlagsEnum flags = MyHudIndicatorFlagsEnum.SHOW_TEXT |
                                            MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS |
                                            MyHudIndicatorFlagsEnum.SHOW_DISTANCE;

            MyHud.ChangeText(m_raceLocations[m_currentCheckPointIndex].Entity, new StringBuilder(label),
                             MyGuitargetMode.Objective, 0, flags);
        }
예제 #6
0
        protected override void SetHudMarker()
        {
            MyHudIndicatorFlagsEnum hudFlags      = MyHudIndicatorFlagsEnum.SHOW_TEXT | MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_HEALTH_BARS | MyHudIndicatorFlagsEnum.SHOW_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_MISSION_MARKER;
            MyGuitargetMode?        guiTargetMode = MyGuitargetMode.Neutral;

            if (PrefabHangarType == MyMwcObjectBuilder_PrefabHangar_TypesEnum.HANGAR &&
                MyFactions.GetFactionsRelation(this.m_owner, MySession.PlayerShip) == MyFactionRelationEnum.Friend)
            {
                guiTargetMode = MyGuitargetMode.Friend;
            }
            else
            {
                hudFlags |= MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR | MyHudIndicatorFlagsEnum.ALPHA_CORRECTION_BY_DISTANCE;
            }


            MyHud.ChangeText(this, new StringBuilder(GetCorrectDisplayName()), guiTargetMode, 0, hudFlags);
        }
예제 #7
0
        public static bool UpdateVoxelMapScript(MyVoxelMap voxelMap)
        {
            if (MyHud.ContainsTextForEntity(voxelMap))
            {
                if (m_outpostReached == false)
                {
                    if (Vector3.Distance(MySession.PlayerShip.GetPosition(), voxelMap.GetPosition()) < REMOVE_FROM_HUD_POSSIBLE_OUTPOST_DISTANCE)
                    {
                        MyHud.RemoveText(voxelMap);
                    }
                }
                else
                {
                    MyHud.RemoveText(voxelMap);
                }
            }

            return(true);
        }
예제 #8
0
        public static bool UpdateStaticAsteroidScript(MyStaticAsteroid staticAsteroid)
        {
            if (MyHud.ContainsTextForEntity(staticAsteroid))
            {
                if (m_outpostReached == false)
                {
                    if (Vector3.Distance(MySession.PlayerShip.GetPosition(), staticAsteroid.GetPosition()) < REMOVE_FROM_HUD_POSSIBLE_OUTPOST_DISTANCE)
                    {
                        MyHud.RemoveText(staticAsteroid);
                    }
                }
                else
                {
                    MyHud.RemoveText(staticAsteroid);
                }
            }

            return(true);
        }
예제 #9
0
        protected override void SetHudMarker()
        {
            if (IsNotEmpty())
            {
                MyHudMaxDistanceMultiplerTypes?maxDistanceMultiplerType = null;

                if (m_cargoBoxType == 0)
                {
                    m_cargoBoxType = GetTypeFromModelLod0Enum(m_modelLod0.ModelEnum);
                }

                string displayName = GetCorrectDisplayName(ref maxDistanceMultiplerType);

                MyHud.ChangeText(this, new StringBuilder(displayName), MyGuitargetMode.CargoBox, 200f, MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_TEXT, maxDistanceMultiplerType: maxDistanceMultiplerType);
            }
            else
            {
                MyHud.RemoveText(this);
            }
        }
예제 #10
0
파일: Gamemode.cs 프로젝트: 0-jack/sbox-ttt
        public override void OnPlayerJoined(Player player)
        {
            if (Phase == Phase.RoundActive)
            {
                player.Team = (int)Team.Barrel;
            }
            else
            {
                // Start player off as spectator
                player.Team = (int)Team.Spectator;
            }

            _players.Add(player);

            MyHud.BroadcastMessage($"{player.Name} joined the game");

            if (Authority)
            {
                RespawnPlayer(player);
            }
        }
예제 #11
0
파일: Gamemode.cs 프로젝트: 0-jack/sbox-ttt
        protected void RoundWarmup()
        {
            if (Time.Now < _timeToStartRound)
            {
                return;
            }

            var barrel = _players[Random.Int(0, _players.Count - 1)];

            if (PlayerCount == 1)
            {
                barrel = null;
            }

            foreach (var player in _players)
            {
                if (player == null || player == barrel)
                {
                    continue;
                }

                player.Team = (int)Team.Human;
                RespawnPlayer(player);
            }

            if (barrel != null)
            {
                barrel.Team = (int)Team.Barrel;
                RespawnPlayer(barrel);

                MyHud.BroadcastMessage($"{barrel.Name} is the barrel!");
            }

            Round++;

            BroadcastRoundStarted();

            _timeToEndRound = Time.Now + RoundTime;
            SwitchPhase(Phase.RoundActive);
        }
예제 #12
0
        private void UpdateHUD(MySmallShip friend, bool isFriend)
        {
            MyHudEntityParams?gettedHudParams = MyHud.GetHudParams(friend);

            if (gettedHudParams != null)
            {
                MyHudEntityParams hudParams = gettedHudParams.Value;
                if (isFriend)
                {
                    hudParams.FlagsEnum  &= ~MyHudIndicatorFlagsEnum.ALPHA_CORRECTION_BY_DISTANCE;
                    hudParams.FlagsEnum  &= ~MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR;
                    hudParams.MaxDistance = 0f;
                }
                else
                {
                    hudParams.FlagsEnum  |= MyHudIndicatorFlagsEnum.ALPHA_CORRECTION_BY_DISTANCE;
                    hudParams.FlagsEnum  |= MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR;
                    hudParams.MaxDistance = 10000f;
                }
                MyHud.ChangeText(friend, hudParams.Text, hudParams.TargetMode, hudParams.MaxDistance, hudParams.FlagsEnum, hudParams.DisplayFactionRelation, maxDistanceMultiplerType: hudParams.MaxDistanceMultiplerType);
            }
        }
예제 #13
0
파일: Gamemode.cs 프로젝트: 0-jack/sbox-ttt
        protected void RoundStarting()
        {
            if (Time.Now < _timeToRoundWarmup)
            {
                return;
            }

            MyHud.BroadcastMessage("Round warmup has started!");

            foreach (var player in _players)
            {
                if (player == null)
                {
                    continue;
                }

                player.Team = (int)Team.Human;
                RespawnPlayer(player);
            }

            _timeToStartRound = Time.Now + RoundWarmupTime;
            SwitchPhase(Phase.RoundWarmup);
        }
예제 #14
0
        public override void Load()
        {
            m_succesDialogStarted   = false;
            m_successDialogFinished = false;
            if (RequiresDrone)
            {
                MyGuiScreenGamePlay.Static.CameraContrlolledObjectChanged += Static_CameraContrlolledObjectChanged;
                if (MyGuiScreenGamePlay.Static.CameraAttachedTo != MyCameraAttachedToEnum.Drone)
                {
                    AddDroneNotification();
                }
            }
            m_objectiveStartTime = MyMinerGame.TotalGamePlayTimeInMilliseconds;
            MySession.Static.EventLog.AddSubmissionAvailable(ID);

            MyMwcLog.WriteLine("Submission " + NameTemp + " loaded.");
            base.Load();

            // Clear player notifications (so that ie. Travel notification can change color immediately)
            MySession.PlayerShip.ClearNotifications();

            if (SuccessDialogId != null)
            {
                MyDialogues.OnDialogueFinished += OnDialogueFinished;
            }

            MyHud.ShowGPSPathToNextObjective(false);


            if (MarkMissionEntities)
            {
                foreach (var item in MissionEntityIDs)
                {
                    SetLocationVisibility(true, MyScriptWrapper.GetEntity(item), MyGuitargetMode.Objective);
                }
            }
        }
예제 #15
0
        public virtual void Start(Vector3 position, Vector3 initialVelocity, Vector3 direction, float impulseMultiplier, MyEntity owner, StringBuilder displayName = null)
        {
            System.Diagnostics.Debug.Assert(Closed);
            Closed = false;
            GuidedInMultiplayer = false;

            if (this.EntityId.HasValue)
            {
                MyEntityIdentifier.RemoveEntity(this.EntityId.Value);
                this.EntityId = null;
            }

            if (this.NeedsId)
            {
                //if(owner.EntityId.HasValue) this.EntityId = MyEntityIdentifier.AllocateId(owner.EntityId.Value.PlayerId);
                //else this.EntityId = MyEntityIdentifier.AllocateId();
                this.EntityId = MyEntityIdentifier.AllocateId();
                MyEntityIdentifier.AddEntityWithId(this);
            }

            if (displayName != null && owner == MySession.PlayerShip)
            {
                DisplayName = displayName.ToString();
                MyHud.AddText(this, displayName, maxDistance: 1000);
            }

            m_isExploded            = false;
            m_cascadeExplosionLevel = 0;
            m_origin           = position;
            m_previousPosition = position;
            m_initialVelocity  = initialVelocity;

            System.Diagnostics.Debug.Assert(owner.EntityId.HasValue, "Shooting entity must have ID");

            m_ownerEntityID      = owner.EntityId.Value;
            m_elapsedMiliseconds = 0;



            Matrix ammoWorld = Matrix.CreateWorld(position, direction, owner.WorldMatrix.Up);

            SetWorldMatrix(ammoWorld);

            this.Physics.Clear();
            this.Physics.Enabled        = true;
            this.Physics.LinearVelocity = initialVelocity;

            if (owner.Physics != null)
            {
                this.Physics.GroupMask = owner.Physics.GroupMask;
            }
            else
            {
                this.Physics.GroupMask = MyGroupMask.Empty;
            }

            //this.Physics.Enabled = true;

            this.Physics.ApplyImpulse(direction * this.Physics.Mass * impulseMultiplier, position);

            MyEntities.Add(this);
            NeedsUpdate = true;
        }
예제 #16
0
        private static void OnSnapshotDone(bool snapshotSuccess, MySessionSnapshot snapshot)
        {
            if (snapshotSuccess)
            {
                if (!MySandboxGame.IsDedicated)
                {
                    var thumbPath = MySession.Static.ThumbPath;
                    try
                    {
                        if (File.Exists(thumbPath))
                        {
                            File.Delete(thumbPath);
                        }
                        MyGuiSandbox.TakeScreenshot(1200, 672, saveToPath: thumbPath, ignoreSprites: true, showNotification: false);
                    }
                    catch (Exception ex)
                    {
                        MySandboxGame.Log.WriteLine("Could not take session thumb screenshot. Exception:");
                        MySandboxGame.Log.WriteLine(ex);
                    }
                }

                snapshot.SaveParallel(completionCallback: () =>
                {
                    if (!MySandboxGame.IsDedicated)
                    {
                        MyHud.PopRotatingWheelVisible();

                        if (MySession.Static != null)
                        {
                            if (snapshot.SavingSuccess)
                            {
                                var notification = new MyHudNotification(MySpaceTexts.WorldSaved, 2500);
                                notification.SetTextFormatArguments(MySession.Static.Name);
                                MyHud.Notifications.Add(notification);
                            }
                            else
                            {
                                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                                           messageText: new StringBuilder().AppendFormat(MyTexts.GetString(MySpaceTexts.WorldNotSaved), MySession.Static.Name),
                                                           messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError)));
                            }
                        }
                    }

                    PopInProgress();
                });
            }
            else
            {
                if (!MySandboxGame.IsDedicated)
                {
                    MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                               messageText: new StringBuilder().AppendFormat(MyTexts.GetString(MySpaceTexts.WorldNotSaved), MySession.Static.Name),
                                               messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError)));
                }

                PopInProgress();
            }

            if (m_callbackOnFinished != null)
            {
                m_callbackOnFinished();
            }

            m_callbackOnFinished = null;

            MyAudio.Static.Mute = false;
        }
예제 #17
0
 private void RemoveLockedHud()
 {
     MyHud.RemoveText(this);
 }
예제 #18
0
 private void AddLockedHud()
 {
     DisplayOnHud = true;
     MyHud.ChangeText(this, MyTextsWrapper.Get(MyTextsWrapperEnum.DoorsLocked), MyGuitargetMode.Enemy, 200f, MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_TEXT | MyHudIndicatorFlagsEnum.SHOW_HEALTH_BARS | MyHudIndicatorFlagsEnum.SHOW_MISSION_MARKER);
 }
예제 #19
0
 protected override void SetHudMarker()
 {
     MyHud.ChangeText(this, new StringBuilder(DisplayName), MyGuitargetMode.Neutral, 0, MyHudIndicatorFlagsEnum.SHOW_TEXT | MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_HEALTH_BARS | MyHudIndicatorFlagsEnum.SHOW_DISTANCE | MyHudIndicatorFlagsEnum.ALPHA_CORRECTION_BY_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_MISSION_MARKER);
 }
예제 #20
0
 private void RemovelabelFormCurrentCheckPoint()
 {
     MyHud.RemoveText(m_raceLocations[m_currentCheckPointIndex].Entity);
 }
예제 #21
0
파일: Gamemode.cs 프로젝트: 0-jack/sbox-ttt
 public void RegisterDeath(Player killer, Player killed, Team killedTeam)
 {
     MyHud?.AddDeathLog(killer.Name, killed.Name, (Team)killer.Team, killedTeam);
 }
예제 #22
0
 protected override void SetHudMarker()
 {
     MyHud.ChangeText(this, new StringBuilder(), null, SearchingDistance, HUD.MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | HUD.MyHudIndicatorFlagsEnum.SHOW_HEALTH_BARS | HUD.MyHudIndicatorFlagsEnum.SHOW_DISTANCE | HUD.MyHudIndicatorFlagsEnum.ALPHA_CORRECTION_BY_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_FACTION_RELATION_MARKER | MyHudIndicatorFlagsEnum.SHOW_MISSION_MARKER | MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR, new HUD.MyHudDisplayFactionRelation(false, false, true));
 }