// Use this for initialization
    void Start()
    {
        BossBrain = GameObject.FindGameObjectWithTag("BossBotTower").GetComponent <BossTowerAI>();

        if (!wheelflashScripts)
        {
            if (gameObject.name == "Bone.019")
            {
                Debug.Log("assigned bone 19");
                wheelflashScripts = GameObject.Find("pSphere4").GetComponent <BossWheelFlash>();
            }

            if (gameObject.name == "Bone.020")
            {
                Debug.Log("assigned bone 20");

                wheelflashScripts = GameObject.Find("pSphere1").GetComponent <BossWheelFlash>();
            }

            if (gameObject.name == "Bone.021")
            {
                Debug.Log("assigned bone 21");

                wheelflashScripts = GameObject.Find("pSphere2").GetComponent <BossWheelFlash>();
            }

            if (gameObject.name == "Bone.022")
            {
                Debug.Log("assigned bone 22");

                wheelflashScripts = GameObject.Find("pSphere3").GetComponent <BossWheelFlash>();
            }
        }

        player = GameObject.FindGameObjectWithTag("Player");
        // WeaponContainer = GameObject.FindGameObjectWithTag("WeaponContainer");
        hitOnce = false;

        //  scriptedSwitchWeapons = GameObject.FindGameObjectWithTag("WeaponContainer").GetComponent<SwitchWeapons>();
        // CurrentPlayerWeapon = scriptedSwitchWeapons.weaponZero;
        // weaponstats = CurrentPlayerWeapon.GetComponent<WeaponStats>();
        //bossparticles = gameObject.GetComponentInChildren<ParticleSystem>().gameObject;
        if (flashwait == 0)
        {
            flashwait = .1f;
        }
        basehealth = 100;

        //bossparticles.SetActive(false);
        currenthealth = basehealth;
        // rend = wheelflashScripts.gameObject.GetComponent<Renderer>();


        playerstats          = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterStats>();
        characterAttackBonus = playerstats.attackBonus;
    }
    void Update()
    {
        if (currenthealth <= 1)
        {
            //ArmGrab.letgo = true;

            StartCoroutine(wheelflashScripts.DeathFlash());

            if (BossTowerAI.BossisDead)
            {
                Destroy(this);
            }
        }

        // if (scriptedSwitchWeapons.weaponZero != null)
        // {
        //CurrentPlayerWeapon = scriptedSwitchWeapons.weaponZero;
        // }

        // weaponstats = CurrentPlayerWeapon.GetComponent<WeaponStats>();
        // weapondmg = weaponstats.WeaponStrength;
        if (ballchainJustgone)
        {
            if (Vector3.Distance(player.transform.position, gameObject.transform.position) < 15)
            {
                StartCoroutine(wheelflashScripts.TestFlash());
            }
        }
        if (wheelflashScripts)
        {
            wheelflashScripts.flashing = flashing;
        }

        if (!wheelflashScripts)
        {
            if (gameObject.name == "Bone.019")
            {
                wheelflashScripts = GameObject.Find("pSphere4").GetComponent <BossWheelFlash>();
            }

            if (gameObject.name == "Bone.020")
            {
                wheelflashScripts = GameObject.Find("pSphere1").GetComponent <BossWheelFlash>();
            }

            if (gameObject.name == "Bone.021")
            {
                wheelflashScripts = GameObject.Find("pSphere2").GetComponent <BossWheelFlash>();
            }

            if (gameObject.name == "Bone.022")
            {
                wheelflashScripts = GameObject.Find("pSphere3").GetComponent <BossWheelFlash>();
            }
        }
    }