// Use this for initialization void Start() { rb = GetComponent <Rigidbody> (); currentHealth = maxHealth; changeHealthScript = GameObject.Find("HeartManager").GetComponent <ChangeHealth> (); anim = GetComponent <Animator> (); cameraScript = GameObject.FindWithTag("MainCamera").GetComponent <RoomSwitch> (); swordScript = GetComponent <SwordDirection> (); inventoryScript = GetComponent <Inventory> (); bowScript = GetComponent <Bow> (); boomerScript = GetComponent <boomerang>(); }
public void ChangeInputValue() { Transform chHealthbox = this.transform.parent.parent; ChangeHealth chHealthScript = chHealthbox.GetComponent <ChangeHealth>(); if (this.name == "InputName") { chHealthScript.nameForHealth = this.GetComponent <InputField>().text; } else if (this.name == "InputHealth") { chHealthScript.health = int.Parse(this.GetComponent <InputField>().text); } }
private void RaiseHealth(int value) => ChangeHealth?.Invoke(this, value);