AddMessageOnce() public static method

public static AddMessageOnce ( string message, Vector3 worldPosition ) : void
message string
worldPosition Vector3
return void
 private void CheckTargets()
 {
     for (int i = targets.Count - 1; i >= 0; i--)
     {
         if (targets[i].Script != null)
         {
             ScreenSpaceDebug.AddMessageOnce(targets[i].LockStrength.ToString(), targets[i].Script.transform.position);
             if (targets[i].NeedsLockSent)
             {
                 targets[i].Script.GetTargetedBy(playerScript);
                 targets[i].TimeSinceLastLockSend = 0f;
             }
             if (targets[i].WasLocked && !targets[i].Locked)
             {
                 targets[i].Script.GetUntargetedBy(playerScript);
             }
             if (targets[i].LockStrength <= Mathf.Epsilon)
             {
                 targets.RemoveAt(i);
             }
             else
             {
                 targets[i].WasLocked = targets[i].Locked;
             }
         }
         else
         {
             targets.RemoveAt(i);
         }
     }
 }
Example #2
0
    public void Update()
    {
        if (networkView.isMine)
        {
            WeaponIndicatorScript.Instance.ShouldRender = Possession != null;
            UpdateShouldCameraSpin();

            Relay.Instance.OptionsMenu.ShouldDisplaySpectateButton = !IsSpectating;

            if (Possession == null)
            {
                if (Input.GetButtonDown("Fire") && !IsSpectating)
                {
                    IndicateRespawn();
                }
            }

            // Update player labels
            if (Camera.current != null)
            {
                foreach (var playerScript in PlayerScript.UnsafeAllEnabledPlayerScripts)
                {
                    if (playerScript == null)
                    {
                        continue;
                    }
                    Vector3 position = Camera.current.WorldToScreenPoint(InfoPointForPlayerScript(playerScript));
                    Vector2 prevScreenPosition;
                    if (!LastGUIDebugPositions.TryGetValue(playerScript, out prevScreenPosition))
                    {
                        prevScreenPosition = (Vector2)position;
                    }
                    Vector2 newScreenPosition = Vector2.Lerp(prevScreenPosition, (Vector2)position,
                                                             1f - Mathf.Pow(0.0000000001f, Time.deltaTime));
                    LastGUIDebugPositions[playerScript] = newScreenPosition;
                }
            }

            IsDoingMenuStuff = Relay.Instance.MessageLog.HasInputOpen;

            // Debug visibility info for other playerscripts
            if (Possession != null)
            {
                foreach (var character in PlayerScript.UnsafeAllEnabledPlayerScripts)
                {
                    if (character != Possession)
                    {
                        bool canSee = Possession.CanSeeOtherPlayer(character);
                        if (canSee)
                        {
                            ScreenSpaceDebug.AddMessageOnce("VISIBLE", character.transform.position);
                        }
                    }
                }
            }

            // Leaderboard show/hide
            // Always show when not possessing anything
            // Never show when already showing options screen
            if (Possession == null || TimeToHoldLeaderboardFor >= 0f)
            {
                Server.Leaderboard.Show = true;
            }
            // Otherwise, show when holding tab
            else
            {
                Server.Leaderboard.Show = Input.GetKey("tab") && !Relay.Instance.ShowOptions;
            }

            TimeToHoldLeaderboardFor -= Time.deltaTime;

            // TODO test this in a multiplayer environment
            // if game is no longer active, i.e., round end or host forced end, then
            if (!this.Server.IsGameActive)
            {
                // force mouse state to be unlocked
                //playerScript.lockMouse = false;
                Cursor.visible   = true;
                Cursor.lockState = CursorLockMode.None;
            }

            //if (!Relay.Instance.ShowOptions && Possession != null && !ShouldDisplayJoinPanel)
            //     playerScript.lockMouse = true;

            // if (ShouldDisplayJoinPanel || Relay.Instance.ShowOptions || !Server.IsGameActive)
            //    playerScript.lockMouse = false;

            // Update ping
            Ping = uLink.Network.GetAveragePing(Server.networkView.owner);
        }

        if (Possession != null)
        {
            // toggle bubble
            Possession.TextBubbleVisible = IsDoingMenuStuff;
        }

        if (Input.GetKeyDown("f11"))
        {
            ScreenSpaceDebug.LogMessageSizes();
        }

        TimeSinceLastRespawnRequest += Time.deltaTime;
    }