Guest User

Untitled

a guest
Apr 5th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class PlayerUI : MonoBehaviour
  6. {
  7.  
  8.     private Player target;
  9.     VariableJoystick _variableJoystick;
  10.  
  11.     // Start is called before the first frame update
  12.     void Start()
  13.     {
  14.        
  15.     }
  16.  
  17.     void Awake()
  18.     {
  19.         this.transform.SetParent(GameObject.Find("Canvas").GetComponent<Transform>(), false);
  20.     }
  21.  
  22.     void Update()
  23.     {
  24.         if (target == null)
  25.         {
  26.             Destroy(this.gameObject);
  27.             return;
  28.         }
  29.     }
  30.  
  31.     public void SetTarget(Player _target)
  32.     {
  33.         if (_target == null)
  34.         {
  35.             Debug.LogError("<Color=Red><a>Missing</a></Color> PlayMakerManager target for PlayerUI.SetTarget.", this);
  36.             return;
  37.         }
  38.  
  39.         // Cache references for efficiency
  40.         target = _target;
  41.     }
  42. }
Add Comment
Please, Sign In to add comment