// Update is called once per frame
    void Update()
    {
        if (unit != null)
        {
            if (unit.canOpenDoor())
            {
                transform.FindChild("CharacterPanel").FindChild("DoorButton").GetComponent <Button>().interactable = true;
            }
            else
            {
                transform.FindChild("CharacterPanel").FindChild("DoorButton").GetComponent <Button>().interactable = false;
            }


            if (unit.getCurrentWeapon().type != lastWeaponType)
            {
                Transform attackButton = transform.Find("CharacterPanel").FindChild("AttackButton");

                attackButton.FindChild("CrossHair").gameObject.SetActive(false);
                attackButton.FindChild("Sword").gameObject.SetActive(false);
                attackButton.FindChild("Shield").gameObject.SetActive(false);

                if (unit.getCurrentWeapon().type == WeaponType.ranged)
                {
                    attackButton.FindChild("CrossHair").gameObject.SetActive(true);
                }

                else if (unit.getCurrentWeapon().type == WeaponType.melee)
                {
                    attackButton.FindChild("Sword").gameObject.SetActive(true);
                }

                else if (unit.getCurrentWeapon().type == WeaponType.shield)
                {
                    attackButton.FindChild("Shield").gameObject.SetActive(true);
                }


                lastWeaponType = unit.getCurrentWeapon().type;
            }
            if (unit.hasAttacked() || unit.isMoving() || (unit.getCurrentWeapon().type == WeaponType.shield && ((Shield)unit.getCurrentWeapon()).isBroken(unit.GetInstanceID())))
            {
                Transform attackButton = transform.Find("CharacterPanel").FindChild("AttackButton");
                attackButton.GetComponent <Button>().interactable = false;
            }
            else
            {
                Transform attackButton = transform.Find("CharacterPanel").FindChild("AttackButton");
                attackButton.GetComponent <Button>().interactable = true;
            }
        }
    }