public void SetupDisplay(MCHealth passedHealthScript) { //this should be used instead of start and called //by MCHealth to make sure there isn't a Start() //dependancy situation in which execusion order matters playerHealthScript = passedHealthScript; heart1 = Instantiate(heartPrefab, transform) as GameObject; heart1.transform.localPosition = heartPosition1; heart2 = Instantiate(heartPrefab, transform) as GameObject; heart2.transform.localPosition = heartPosition2; heart3 = Instantiate(heartPrefab, transform) as GameObject; heart3.transform.localPosition = heartPosition3; heart4 = Instantiate(heartPrefab, transform) as GameObject; heart4.transform.localPosition = heartPosition4; }
// Use this for initialization void Start() { myPlayer = GameObject.FindWithTag("Player"); myHealthScript = myPlayer.GetComponent <MCHealth> (); hitBoxEnabled = true; }
// Use this for initialization void Start() { //get a refrence to the MCHealth Script myHealthScript = this.GetComponentInParent <MCHealth>(); }