void Start () { player = GameObject.FindWithTag ("Player").transform; pHealth = player.GetComponent<PlayerHealth> (); pAttack = player.GetComponent<PlayerAttack> (); eHealth = GetComponent<EnemyHealth> (); Rigidbody = GetComponent<Rigidbody> (); }
public void Setup () { PMove = Instance.GetComponent<PlayerMovement> (); PAttack = Instance.GetComponent<PlayerAttack> (); EMove = Instance.GetComponent<EnemyMovement> (); EAttack = Instance.GetComponent<EnemyAttack> (); CanvasGameObject = Instance.GetComponentInChildren<Canvas> ().gameObject; ColoredPlayerText = "<color=#" + ColorUtility.ToHtmlStringRGB (PlayerColor) + ">TANK " + "</color>"; MeshRenderer[] renderers = Instance.GetComponentsInChildren<MeshRenderer> (); for (int i = 0; i < renderers.Length; i++) { renderers[i].material.color = PlayerColor; } }