예제 #1
0
        void Update()
        {
            this.spectatorCanvas.enabled = Spectator.IsSpectating();

            if (this.spectatorCanvas.enabled)
            {
                // update text based on spectated object

                string text = "";

                var co = Spectator.GetSpectatingGameObject().GetComponent <ControllableObject> ();
                if (co != null)
                {
                    var player = co.playerOwner;
                    if (player != null)
                    {
                        text = player.playerName + " ";
                        if (player.Team != "")
                        {
                            text += "(" + player.Team + ") ";
                        }
                        text += "<color=orange>[" + player.health + "]</color>";
                    }
                    else
                    {
                        //	Debug.LogWarning ("Spectated controllable object has no player owner");
                    }
                }

                this.spectatingObjectText.text = text;
            }
        }
예제 #2
0
        void Start()
        {
            // add button handlers

            if (goPreviousButton != null)
            {
                goPreviousButton.onClick.AddListener(() => { Spectator.FindObjectForSpectating(-1); });
            }

            if (goNextButton != null)
            {
                goNextButton.onClick.AddListener(() => { Spectator.FindObjectForSpectating(1); });
            }
        }
예제 #3
0
        // Update is called once per frame
        void Update()
        {
            if (null == Camera.main)
            {
                return;
            }

            if (null == Player.local)
            {
                return;
            }

            if (Player.local.GetControllingGameObject() == this.gameObject || Spectator.GetSpectatingGameObject() == this.gameObject)
            {
                this.UpdateCamera();
            }
        }