Exemple #1
0
    public void AIFierce(int maxNum, int standNum)
    {
        int crouchOrStand = Random.Range(0, maxNum);

        if (GetConditions())
        {
            character.AttackState();
            if (crouchOrStand <= standNum)
            {
                AIStand();
            }
            else
            {
                AICrouch();
            }
            if (character.GetComponent <FeiLong>() != null)
            {
                if (sharedProperties.GetAbDistanceFromOtherFighter() < 0.75f && animator.GetBool("isStanding") == true)
                {
                    feiLong.FeiLongCloseFierce();
                }
                else
                {
                    character.CharacterFierce();
                }
            }
            else
            {
                character.CharacterFierce();
            }
            AIStand();
        }
    }
    void PunchBagControls()
    {
        if (Input.GetKey(KeyCode.Alpha2))
        {
            if (character.side == Character.Side.P1)
            {
                pressedForward = true;
                animator.SetBool("isWalkingForward", true);
            }
            else
            {
                pressedBackward = true;
                animator.SetBool("isWalkingBackward", true);
            }
            character.transform.Translate(Vector3.right * character.GetWalkSpeed() * Time.deltaTime);
        }
        if (Input.GetKey(KeyCode.Alpha1))
        {
            if (character.side == Character.Side.P2)
            {
                pressedForward = true;
                animator.SetBool("isWalkingForward", true);
            }
            else
            {
                pressedBackward = true;
                animator.SetBool("isWalkingBackward", true);
            }
            character.transform.Translate(Vector3.left * character.GetWalkSpeed() * Time.deltaTime);
        }
        if (Input.GetKeyUp(KeyCode.Alpha2))
        {
            if (character.side == Character.Side.P1)
            {
                pressedForward = false;
                animator.SetBool("isWalkingForward", false);
            }
            else
            {
                pressedBackward = false;
                animator.SetBool("isWalkingBackward", false);
            }
        }
        if (Input.GetKeyUp(KeyCode.Alpha1))
        {
            if (character.side == Character.Side.P2)
            {
                pressedForward = false;
                animator.SetBool("isWalkingForward", false);
            }
            else
            {
                pressedBackward = false;
                animator.SetBool("isWalkingBackward", false);
            }
        }

        if (animator.GetBool("isAttacking") == false && animator.GetBool("isInHitStun") == false &&
            animator.GetBool("isInBlockStun") == false && animator.GetBool("isLiftingOff") == false &&
            animator.GetBool("isStanding") == true && animator.GetBool("isAirborne") == false)
        {
            if (Input.GetKeyDown(KeyCode.R))
            {
                character.CharacterJump(pressedForward, pressedBackward);
                animator.SetBool("isStanding", false);
                animator.SetBool("isLiftingOff", true);
            }
        }
//		Walk();

        if (animator.GetBool("isAttacking") == false)
        {
            if (Input.GetKeyDown(KeyCode.Y))
            {
                if (character.GetComponent <FeiLong>() != null && Mathf.Abs(distance) < 0.75f && animator.GetBool("isStanding") == true)
                {
                    feiLong.FeiLongCloseJab();
                }
                else
                {
                    character.CharacterJab();
                }
                character.AttackState();
            }
            if (Input.GetKeyDown(KeyCode.T))
            {
                if (character.GetComponent <FeiLong>() != null && Mathf.Abs(distance) < 0.75f && animator.GetBool("isStanding") == true)
                {
                    feiLong.FeiLongCloseFierce();
                }
                else
                {
                    character.CharacterFierce();
                }
                character.AttackState();
            }
            if (Input.GetKeyDown(KeyCode.E))
            {
                character.AttackState();
                character.CharacterRoundhouse();
            }
            if (Input.GetKeyDown(KeyCode.W))
            {
                character.AttackState();
                character.CharacterForward();
            }
            if (Input.GetKeyDown(KeyCode.G))
            {
                character.AttackState();
                animator.Play("ThrowStartup");
            }
            if (Input.GetKeyDown(KeyCode.H))
            {
                character.AttackState();
                character.CharacterStrong();
            }
        }
        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            if (character.GetComponent <Ken>() != null)
            {
                if (animator.GetBool("isAttacking") == false)
                {
                    character.AttackState();
                    animator.Play("KenShinryuken", 0);
                }
                animator.SetTrigger("motionSuperInputed");
            }
            else if (character.GetComponent <FeiLong>() != null)
            {
                if (animator.GetBool("isAttacking") == false)
                {
                    character.AttackState();
                    animator.Play("FeiLongRekkaShinken", 0);
                }
                animator.SetTrigger("motionSuperInputed");
            }
            else if (character.GetComponent <Sagat>() != null)
            {
                if (animator.GetBool("isAttacking") == false)
                {
                    character.AttackState();
                    animator.Play("SagatTigerCannon", 0);
                }
                animator.SetTrigger("motionSuperInputed");
            }
            else if (character.GetComponent <MBison>() != null)
            {
                if (animator.GetBool("isAttacking") == false)
                {
                    character.AttackState();
                    animator.Play("MBisonKneePressNightmare", 0);
                }
                animator.SetTrigger("motionSuperInputed");
            }
            else if (character.GetComponent <Akuma>() != null)
            {
                character.AttackState();
                animator.Play("AkumaShunGokuSatsuStartup", 0);
            }
        }
        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            if (character.GetComponent <Ken>() != null)
            {
                if (animator.GetBool("isAttacking") == false && animator.GetBool("isAirborne") == false)
                {
                    animator.Play("KenHurricaneKickLiftOff", 0);
                    character.AttackState();
                }
                animator.SetTrigger("hurricaneKickInputed");
                animator.SetInteger("hurricaneKickType", 2);
            }
            else if (character.GetComponent <FeiLong>() != null)
            {
                if (animator.GetBool("isAttacking") == false)
                {
                    character.AttackState();
                    animator.Play("FeiLongRekkaKun", 0);
                }
                animator.SetTrigger("shoryukenInputed");
                animator.SetInteger("rekkaKunKickType", 2);
            }
        }
        if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            if (character.GetComponent <Ken>() != null)
            {
                if (animator.GetBool("isAttacking") == false && animator.GetBool("isAirborne") == false)
                {
                    animator.Play("KenHadouken", 0);
                    character.AttackState();
                }
                animator.SetTrigger("hadoukenInputed");
                animator.SetInteger("hadoukenPunchType", 0);
            }
        }
        if (Input.GetKey(KeyCode.Q))
        {
            if (animator.GetBool("isInHitStun") == false && animator.GetBool("isInBlockStun") == false &&
                animator.GetBool("isLiftingOff") == false && animator.GetBool("isAirborne") == false &&
                animator.GetBool("isKnockedDown") == false && animator.GetBool("isMidAirRecovering") == false)
            {
                if (character.GetComponent <Ken>() != null)
                {
                    animator.SetTrigger("shoryukenInputed");
                    if (animator.GetBool("isAttacking") == false)
                    {
                        character.AttackState();
                        animator.Play("KenShoryukenFierce", 0);
                    }
                    animator.SetTrigger("shoryukenInputed");
                    animator.SetInteger("shoryukenPunchType", 2);
                }
                else if (character.GetComponent <FeiLong>() != null)
                {
                    if (animator.GetBool("isAttacking") == false)
                    {
                        character.AttackState();
                        animator.Play("FeiLongShienKyakuShort", 0);
                    }
                    animator.SetTrigger("reverseShoryukenInputed");
                    animator.SetInteger("shienKyakuKickType", 0);
                }
                else if (character.GetComponent <Akuma>() != null)
                {
                    animator.SetTrigger("shoryukenInputed");
                    if (animator.GetBool("isAttacking") == false)
                    {
                        character.AttackState();
                        animator.Play("AkumaShoryukenFierce", 0);
                    }
                    animator.SetTrigger("shoryukenInputed");
                    animator.SetInteger("shoryukenPunchType", 2);
                }
                else if (character.GetComponent <MBison>() != null)
                {
                    if (animator.GetBool("isAttacking") == false)
                    {
                        character.AttackState();
                        animator.Play("MBisonHeadStomp", 0);
                    }
                    animator.SetTrigger("headStompInputed");
                    animator.SetInteger("headStompKickType", 2);
                    animator.SetTrigger("somerSaultInputed");
                }
            }
        }
        if (Input.GetKey(KeyCode.L))
        {
            animator.SetBool("isStanding", false);
            animator.SetBool("isCrouching", true);
        }
        if (Input.GetKey(KeyCode.O))
        {
            animator.SetBool("isStanding", true);
            animator.SetBool("isCrouching", false);
        }
        character.SetBackPressed(pressedBackward);
    }