// Use this for initialization void Start() { if (MultiPlayerPlayer.GetIfMainPlayer()) { isMainPlayer = true; } healthBarHolder = GameObject.FindWithTag("Health"); healthText = healthBarHolder.transform.Find("HealthText").GetComponent <TextMeshProUGUI>(); primaryHealthBar = healthBarHolder.transform.Find("PrimaryHealthBar").GetComponent <Image>(); secondaryHealthBar = healthBarHolder.transform.Find("SecondaryHealthBar").GetComponent <Image>(); playerColor = this.transform.Find("Sprite").GetComponent <SpriteRenderer>().color; gameManager = GameObject.FindWithTag("GameManager").GetComponent <GameManager>(); }
private void Start() { foreach (Transform child in transform) { if (child.name == "BulletSpawner") { bulletSpawner = child; } } multiPlayerPlayer = GetComponentInParent <MultiPlayerPlayer>(); if (multiPlayerPlayer.GetIfMainPlayer()) { Transform gunIconLocation = GameObject.FindWithTag("Health").transform.Find("Gun Icon"); GameObject iconIns = Instantiate(gunIcon, gunIconLocation); gunIconOverlay = iconIns.transform.Find("IconBackGround").GetComponent <Image>(); } }