Example #1
0
 // 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>();
 }
Example #2
0
    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);
        }
    }
Example #3
0
 private void RaiseHealth(int value) => ChangeHealth?.Invoke(this, value);