Example #1
0
    /// <summary>
    /// Assigns a Player Target to Follow and represent.
    /// </summary>
    /// <param name="target">Target.</param>
    public void SetTarget(PlayerManagerCarPhoton _target)
    {
        if (_target == null)
        {
            Debug.LogError("<Color=Red><b>Missing</b></Color> PlayMakerManager target for PlayerUI.SetTarget.", this);
            return;
        }

        // Cache references for efficiency because we are going to reuse them.
        this.target     = _target;
        targetTransform = this.target.GetComponent <Transform>();
        targetRenderer  = this.target.CarUiRenderer;


        BoxCollider boxCollider = this.target.GetComponent <BoxCollider>();

        // Get data from the Player that won't change during the lifetime of this Component
        if (boxCollider != null)
        {
            characterControllerHeight = boxCollider.center.y + (boxCollider.size.y * 2);
        }

        if (playerNameText != null)
        {
            playerNameText.text = this.target.photonView.Owner.NickName;
        }
    }
Example #2
0
 public void UpdateWithCar(PlayerManagerCarPhoton car)
 {
     if (car == null)
     {
         this.gameObject.SetActive(false);
     }
     else
     {
         this.gameObject.SetActive(true);
         this.nameText.text  = car.photonView.Owner.NickName;
         this.scoreText.text = car.Junk.ToString();
     }
 }