public void startCharge()
 {
     //Debug.Log("chargeUp");
     state = chargeState.CHARED;
     runChargeParticle.Play();
     statContol.ChangeSpeedPercent(0.2f);
     isCharged = true;
 }
    override public void getCommand(string cmd)
    {
        if (isDeath)
        {
            return;
        }
        switch (cmd)
        {
        case "ATTACK":
            performAttack();
            break;

        case "BLOCK":
            StopCoroutine("chargeDelay");
            if (state == chargeState.CHARGING && !isCharged)
            {
                StopCoroutine("waitForCharge");
                state = chargeState.NONE;
            }
            StartCoroutine("chargeDelay");
            performBlock();
            // Attack();
            break;

        case "UNBLOCK":
            performUnBlock();
            break;

        case "CHARGEUP":
            if (!isCharged)
            {
                chargeUP();
            }

            break;

        case "CHARGERELEASE":
            StopCoroutine("chargeDelay");
            if (state == chargeState.CHARGING && !isCharged)
            {
                StopCoroutine("waitForCharge");
                state = chargeState.NONE;
            }
            StartCoroutine("chargeDelay");
            break;

        case "ULTIMATE":

            preformUltimate();

            break;

        default:
            base.getCommand(cmd);

            break;
        }
    }
 public void chargeRelease()
 {
     if (state == chargeState.CHARED && isCharged)
     {
         //Debug.Log("stopCharge");
         state = chargeState.NONE;
         //StopCoroutine("waitForCharge");
         //StartCoroutine("chargeDelay");
         runChargeParticle.Stop();
         isCharged = false;
         statContol.ChangeSpeedPercent(-0.2f);
     }
     // chargState = 0;
 }
    public void chargeUP()
    {
        //Debug.Log("startCharge");
        if (!isCharged && state == chargeState.NONE)
        {
            state = chargeState.CHARGING;
            StartCoroutine("waitForCharge");
        }
        else if (isCharged && state == chargeState.CHARED)
        {
            StopCoroutine("chargeDelay");
        }

        /*  if (chargState < 3)
         * {
         *    chargState++;
         *    isCharging = true;
         * }*/
    }
    public void performAttack()
    {
        //Debug.Log("preformATk");
        //if (isCharging) return;
        swordParticle.Play();
        if (state == chargeState.CHARGING && !isCharged)
        {
            StopCoroutine("waitForCharge");
            state = chargeState.NONE;
        }

        StopCoroutine("chargeDelay");
        //-----------------------------------------------
        if (!isCharged)
        {
            isAtk = true;
            //Debug.Log("isCharge preform 1");
            //if (anim.GetInteger("Speed") < 3)
            //{

            //    anim.SetInteger("Speed", 3);
            //}
            anim.SetTrigger("ATK");
            if (isBlocking)
            {
                //anim.SetInteger("Speed", 0);
                hitbox.isImmortal = false;
                updateStamina();
                shieldEff.SetActive(false);
            }
            anim.speed = atkSpeed;
        }
        else
        {
            //Debug.Log("isCharge preform 3");
            performAtk3C();
        }

        anim.SetFloat("Accel", 1f);
        //----------------------------------------------
        //if (!isAtk && !isBlocking)
        //{

        //    isReceiving = false;
        //    if (!isCharged)
        //    {

        //        isAtk = true;
        //        //Debug.Log("isCharge preform 1");
        //        //if (anim.GetInteger("Speed") < 3)
        //        //{

        //        //    anim.SetInteger("Speed", 3);
        //        //}
        //        anim.SetTrigger("ATK");
        //    }
        //    else
        //    {

        //        //Debug.Log("isCharge preform 3");
        //        performAtk3C();
        //    }
        //    anim.SetFloat("Accel", 1f);

        //    //setNormalAtk();
        //}
        //else if(isBlocking)
        //{
        //    anim.SetTrigger("ATK");
        //    //anim.SetInteger("Speed", 0);
        //    hitbox.isImmortal = false;
        //    updateStamina();
        //    shieldEff.SetActive(false);
        //}
        //----------------------------
    }