Example #1
0
    void FixedUpdate()
    {
        if (playerInfo.life <= 0)
        {
            return;
        }

        if (GameMaster.Instance.state != GameMaster.GameState.Start)
        {
            return;
        }

        if (playerInfo.humanType == PlayerInfo.HumanType.Com)
        {
            action = enemyAi.GetAction(playerInfo, humanPlayer.tag);
        }

        AnimatorStateInfo state = animator.GetCurrentAnimatorStateInfo(0);

        if (isDamage || gameObject.tag == Const.TAG_NOMOVE || gameObject.tag == Const.TAG_NODAMAGE ||
            state.IsName("Solt") ||
            state.IsName("BigDamage") ||
            gameObject.tag == Const.TAG_SPECIAL_START ||
            gameObject.tag == Const.TAG_SPECIAL ||
            gameObject.tag == Const.TAG_SPECIAL_FALL ||
            gameObject.tag == Const.TAG_SPECIAL_UPPER ||
            gameObject.tag == Const.TAG_HADOUKEN ||
            gameObject.tag == Const.TAG_MIDDLE_DAMAGE ||
            gameObject.tag == Const.TAG_DOWN ||
            isHadouken ||
            specialMove ||
            gameObject.tag == Const.TAG_DEAD)
        {
            return;
        }

        if (!firstPunch && !special && !specialMove && action == PlayerInfo.Action.Special)
        {
            special = true;
            Invoke("SpecialOff", 0.5f);
            animator.SetBool("Special", true);
        }
        else if (!firstPunch && action == PlayerInfo.Action.Punch)
        {
            firstPunch = true;
            Invoke("PuchOff", 0.4f);
            animator.SetBool("Jab", true);
        }
        else if (firstKick && action == PlayerInfo.Action.Kick)
        {
            animator.SetBool("Solt", true);
        }
        else if (!firstKick && !state.IsName("Hikick") && action == PlayerInfo.Action.Kick)
        {
            firstKick = true;
            Invoke("KickOff", 0.6f);
            animator.SetBool("Hikick", true);
        }
        else if (action == PlayerInfo.Action.Guard)
        {
            animator.SetBool("Guard", true);
            return;
        }
        else if (action == PlayerInfo.Action.SS)
        {
            if (playerInfo.sGage >= Const.MAX_S_GAGE)
            {
                animator.SetBool("Hadouken", true);
            }
        }
        else
        {
            animator.SetBool("Guard", false);
        }

        action = PlayerInfo.Action.None;
    }