Beispiel #1
0
 public void Recover()
 {
     Move.rb.velocity = new Vector2(.5f * Move.rb.velocity.x, .2f * Move.rb.velocity.y);
     if (MaxInput.GetAxis(Move.Horizontal) > 0)
     {
         Move.HitDetect.KnockBack = new Vector2(.5f * Move.backDashForce, .5f * Move.jumpPower);
     }
     else if (MaxInput.GetAxis(Move.Horizontal) < 0)
     {
         Move.HitDetect.KnockBack = new Vector2(-.5f * Move.backDashForce, .5f * Move.jumpPower);
     }
     else if (MaxInput.GetAxis(Move.Vertical) < 0 && transform.position.y > 1.5f)
     {
         Move.HitDetect.KnockBack = new Vector2(0, -.3f * Move.jumpPower);
     }
     else
     {
         Move.HitDetect.KnockBack = new Vector2(0, .5f * Move.jumpPower);
     }
 }
    void Update()
    {
        currentState = anim.GetCurrentAnimatorStateInfo(0);
        anim.ResetTrigger(IDRec);

        if (Move.HitDetect.hitStun > 0)
        {
            anim.ResetTrigger(ID5L);
            anim.ResetTrigger(ID2L);
            anim.ResetTrigger(ID5M);
            anim.ResetTrigger(ID2M);
            anim.ResetTrigger(ID5H);
            anim.ResetTrigger(ID2H);
            anim.ResetTrigger(ID5B);
            anim.ResetTrigger(ID2B);
            anim.ResetTrigger(IDThrow);

            /*anim.ResetTrigger(IDBloodBrave);
             * anim.ResetTrigger(IDPatissiere);
             * anim.ResetTrigger(IDHeadRush);
             * anim.ResetTrigger(IDToaster);*/
        }

        if (lightButton > 0)
        {
            lightButton -= Time.deltaTime;
        }
        else
        {
            lightButton = 0;
            anim.ResetTrigger(ID5L);
            anim.ResetTrigger(ID2L);
        }

        if (mediumButton > 0)
        {
            mediumButton -= Time.deltaTime;
        }
        else
        {
            mediumButton = 0;
            anim.ResetTrigger(ID5M);
            anim.ResetTrigger(ID2M);
        }

        if (heavyButton > 0)
        {
            heavyButton -= Time.deltaTime;
        }
        else
        {
            heavyButton = 0;
            anim.ResetTrigger(ID5H);
            anim.ResetTrigger(ID2H);
        }

        if (breakButton > 0)
        {
            breakButton -= Time.deltaTime;
        }
        else
        {
            breakButton = 0;
            anim.ResetTrigger(ID5B);
            anim.ResetTrigger(ID2B);
            anim.ResetTrigger(ID3B);
        }

        if (dir1 > 0)
        {
            dir1 -= Time.deltaTime;
        }
        if (dir2 > 0)
        {
            dir2 -= Time.deltaTime;
        }
        if (dir3 > 0)
        {
            dir3 -= Time.deltaTime;
        }
        if (dir4 > 0)
        {
            dir4 -= Time.deltaTime;
        }
        if (dir6 > 0)
        {
            dir6 -= Time.deltaTime;
        }
        if (QCF > 0)
        {
            QCF -= Time.deltaTime;
        }
        if (QCB > 0)
        {
            QCB -= Time.deltaTime;
        }
        if (HCB > 0)
        {
            HCB -= Time.deltaTime;
        }
        if (DP > 0)
        {
            DP -= Time.deltaTime;
        }


        //record buttons pressed
        if (MaxInput.GetButtonDown(Light) && !anim.GetCurrentAnimatorStateInfo(0).IsName("ForsythiaAim"))
        {
            lightButton = bufferTime;
        }
        if (MaxInput.GetButtonDown(Medium))
        {
            mediumButton = bufferTime;
        }
        if (MaxInput.GetButtonDown(Heavy))
        {
            heavyButton = bufferTime;
        }
        if (MaxInput.GetButtonDown(Break) && !anim.GetCurrentAnimatorStateInfo(0).IsName("ForsythiaAim"))
        {
            breakButton = bufferTime;
        }
        if (MaxInput.GetButtonDown(LM))
        {
            lightButton  = bufferTime;
            mediumButton = bufferTime;
        }
        if (MaxInput.GetButtonDown(HB))
        {
            heavyButton = bufferTime;
            breakButton = bufferTime;
        }
        if (MaxInput.GetButtonDown(LB))
        {
            lightButton = bufferTime;
            breakButton = bufferTime;
        }
        if (MaxInput.GetButtonDown(MH))
        {
            mediumButton = bufferTime;
            heavyButton  = bufferTime;
        }
        QCFCheck();
        QCBCheck();
        HCBCheck();
        DPCheck();

        //record directional input
        //float dir# corresponds to numpad notation for character facing to the right
        //special moves' directional input for DHA will never use 7 8 or 9, and 5 is the neutral position so no variables for those directions is necessary,

        /*           up
         *           ^
         |
         |         7 8 9
         | left <--- 4 5 6 ---> right
         |         1 2 3
         |
         |           v
         |          down
         */
        // pressing left on the d pad or stick, considered backward if facing right, considered forward if facing left
        if (MaxInput.GetAxis(Horizontal) < 0 && MaxInput.GetAxis(Vertical) < 0)
        {
            if (Move.transform.position.x < Move.opponent.position.x)
            {
                // 1 : pressing down-back
                dir1 = directionBufferTime;
            }
            else if (Move.transform.position.x > Move.opponent.position.x)// 3 : pressing down-forward
            {
                dir3 = directionBufferTime;
            }
        }
        else if (MaxInput.GetAxis(Horizontal) > 0 && MaxInput.GetAxis(Vertical) < 0)
        {
            if (Move.transform.position.x < Move.opponent.position.x)
            {
                // pressing down-forward
                dir3 = directionBufferTime;
            }
            else if (Move.transform.position.x > Move.opponent.position.x)
            {
                // pressing down-back
                dir1 = directionBufferTime;
            }
        }
        else if (MaxInput.GetAxis(Horizontal) < 0)
        {
            if (Move.transform.position.x < Move.opponent.position.x)
            {
                // pressing back if facing right
                dir4 = directionBufferTime;
            }
            else if (Move.transform.position.x > Move.opponent.position.x)
            {
                // pressing forward if facing left
                dir6 = directionBufferTime;
            }
        }
        // pressing right on the d pad/stick, considered forward if facing right, considered backward if facing left
        else if (MaxInput.GetAxis(Horizontal) > 0)
        {
            if (Move.transform.position.x < Move.opponent.position.x)
            {
                //forward if facing right
                dir6 = directionBufferTime;
            }
            else if (Move.transform.position.x > Move.opponent.position.x)
            {
                //back if facing left
                dir4 = directionBufferTime;
            }
        }
        else if (MaxInput.GetAxis(Vertical) < 0)
        {
            //only pressing down
            dir2 = directionBufferTime;
        }

        if (Actions.acceptMove || currentState.IsName("StandUp") || currentState.IsName("Jump"))
        {
            //refresh possible moves when in certain states
            RefreshMoveList();
        }

        //dizzy state, mash buttons to get out of it faster
        if ((dizzyTime == 0 && anim.GetBool(dizzyID)) || anim.GetBool(KOID))
        {
            dizzyTime = 300;
        }
        else if (!anim.GetBool(dizzyID) || CharProp.currentHealth == CharProp.maxHealth)
        {
            dizzyTime = 0;
        }

        if (dizzyTime > 0)
        {
            anim.SetBool(dizzyID, true);
            dizzyTime--;
            if (MaxInput.GetButtonDown(Light))
            {
                dizzyTime -= 5;
            }
            if (MaxInput.GetButtonDown(Medium))
            {
                dizzyTime -= 5;
            }
            if (MaxInput.GetButtonDown(Heavy))
            {
                dizzyTime -= 5;
            }
            if (MaxInput.GetButtonDown(Break))
            {
                dizzyTime -= 5;
            }
        }

        if (dizzyTime <= 0 && anim.GetBool(dizzyID))
        {
            anim.SetBool(dizzyID, false);
            CharProp.refill     = true;
            CharProp.comboTimer = 0;
        }

        //aerial recovery, press a button after hitstun ends
        if ((currentState.IsName("HitAir") || currentState.IsName("FallForward") || currentState.IsName("SweepHit") || currentState.IsName("LaunchTransition") ||
             currentState.IsName("LaunchFall") || currentState.IsName("Unstick")) && Move.HitDetect.hitStun <= 0 &&
            Move.transform.position.y > 1.1f && (lightButton > 0 || mediumButton > 0 || heavyButton > 0 || breakButton > 0))
        {
            anim.SetTrigger(IDRec);
        }

        if (currentState.IsName("AirRecovery"))
        {
            lightButton  = 0;
            mediumButton = 0;
            heavyButton  = 0;
            breakButton  = 0;
        }


        if (blitzActive > 0 && Hitboxes.HitDetect.OpponentDetector.Actions.blitzed <= 0)
        {
            Hitboxes.BlitzCancel();
            blitzActive -= Time.deltaTime;
        }
        else if (Hitboxes.HitDetect.OpponentDetector.Actions.blitzed > 0)
        {
            blitzActive = 0;
        }

        //blitz cancel mechanic, return to neutral position to extend combos, cancel recovery, make character safe, etc. at the cost of one hit of armor
        if ((Actions.blitzCancel && Move.HitDetect.hitStun <= 0 && Move.HitDetect.blockStun <= 0 && CharProp.armor >= 1) &&
            Move.HitDetect.hitStop <= 0 && heavyButton > 0 && mediumButton > 0 && Mathf.Abs(heavyButton - mediumButton) <= .1f)
        {
            RefreshMoveList();
            BlitzWave.SetTrigger(IDBlitz);
            Hitboxes.BlitzCancel();
            Actions.landingLag = 0;

            ForsythiaReticle.SetActive(false);
            anim.SetBool(runID, false);
            BlitzImage.sprite = anim.gameObject.GetComponent <SpriteRenderer>().sprite;
            BlitzImage.color  = new Color(BlitzImage.color.r, BlitzImage.color.g, BlitzImage.color.b, .75f);
            BlitzEffect.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z);
            BlitzEffect.transform.rotation = transform.rotation;

            anim.SetTrigger(IDBlitz);
            if (Actions.airborne && MaxInput.GetAxis(Vertical) < 0)
            {
                Move.rb.velocity = Vector2.zero;
                Move.rb.AddForce(new Vector2(0, -4), ForceMode2D.Impulse);
            }
            else if (Actions.airborne && MaxInput.GetAxis(Horizontal) < 0)
            {
                if (Move.rb.velocity.y < 0)
                {
                    Move.rb.velocity = Vector2.zero;
                }
                else
                {
                    Move.rb.velocity = new Vector2(0, Move.rb.velocity.y);
                }
                Move.rb.AddForce(new Vector2(-2.7f, 0), ForceMode2D.Impulse);
            }
            else if (Actions.airborne && MaxInput.GetAxis(Horizontal) > 0)
            {
                if (Move.rb.velocity.y < 0)
                {
                    Move.rb.velocity = Vector2.zero;
                }
                else
                {
                    Move.rb.velocity = new Vector2(0, Move.rb.velocity.y);
                }
                Move.rb.AddForce(new Vector2(2.7f, 0), ForceMode2D.Impulse);
            }

            if (Move.HitDetect.comboCount > 0)
            {
                Move.HitDetect.specialProration *= .85f;
            }

            //cost for executing blitz cancel
            CharProp.armor--;
            CharProp.durability            = 70;
            blitzActive                    = 5f / 60f;
            CharProp.durabilityRefillTimer = 0;
            heavyButton                    = 0;
            mediumButton                   = 0;
        }
        // basic throw performed by pressing both light and break attack
        else if (Actions.acceptMove && lightButton > 0 && breakButton > 0 && Move.HitDetect.hitStop <= 0)
        {
            Hitboxes.ClearHitBox();
            if (Actions.standing)
            {
                anim.SetTrigger(IDThrow);
                if (dir4 == directionBufferTime)
                {
                    Actions.backThrow = true;
                }
                else
                {
                    Actions.backThrow = false;
                }

                Actions.throwTech = true;
            }
        }
        else if (Actions.acceptSuper && lightButton > 0 && mediumButton > 0 && Move.HitDetect.hitStop <= 0 && QCF > 0 && CharProp.armor >= 2 && Actions.standing)
        {
            Move.jumping = 0;
            Hitboxes.ClearHitBox();
            // Forsythia Marduk super attack, executed by doing a QCF and pressing L and M together
            anim.SetTrigger(IDForsythia);
            CharProp.armor                -= 2;
            CharProp.durability            = 70;
            CharProp.durabilityRefillTimer = 0;
            lightButton  = 0;
            mediumButton = 0;
            QCF          = 0;
        }
        else if (Actions.acceptSpecial && (heavyButton > 0 || breakButton > 0) && Move.HitDetect.hitStop <= 0 && DP > 0)
        {
            Move.jumping = 0;
            Hitboxes.ClearHitBox();
            // Heaven Climber special attack, executed by doing a DP and pressing H or B
            if (Actions.airborne || heavyButton > 0)
            {
                anim.SetTrigger(IDHeavenClimberH);
            }
            else
            {
                anim.SetTrigger(IDHeavenClimberB);
            }
            Actions.TurnAroundCheck();
            heavyButton = 0;
            breakButton = 0;
            DP          = 0;
        }
        else if (Actions.acceptSpecial && breakButton > 0 && Move.HitDetect.hitStop <= 0 && QCB > 0 && Actions.airborne && Hitboxes.HitDetect.Actions.Move.transform.position.y > 1.5f)
        {
            Move.jumping = 0;
            Hitboxes.ClearHitBox();
            // Starfall special attack, executed by doing a QCB and pressing B
            anim.SetTrigger(IDStarfall);
            Actions.TurnAroundCheck();
            breakButton = 0;
            QCB         = 0;
        }
        else if (Actions.acceptSpecial && mediumButton > 0 && Move.HitDetect.hitStop <= 0 && QCF > 0 && !Actions.airborne)
        {
            Move.jumping = 0;
            Hitboxes.ClearHitBox();
            // Level Hell special attack, executed by doing a QCF and pressing M
            anim.SetTrigger(IDLevelHell);
            Actions.TurnAroundCheck();
            mediumButton = 0;
            QCF          = 0;
        }
        else if (Actions.acceptBreak && breakButton > 0 && Move.HitDetect.hitStop <= 0)
        {
            //break attacks
            if (Actions.standing)
            {
                if (MaxInput.GetAxis(Vertical) < 0)
                {
                    if (CrouchB)
                    {
                        anim.SetTrigger(ID2B);
                        CrouchB = false;
                        Actions.TurnAroundCheck();
                        Hitboxes.ClearHitBox();
                    }
                }
                else if (dir3 == directionBufferTime)
                {
                    if (DFB)
                    {
                        anim.SetTrigger(ID3B);
                        DFB = false;
                        anim.SetBool(runID, false);
                        Hitboxes.ClearHitBox();
                    }
                }
                else
                {
                    if (StandB)
                    {
                        anim.SetTrigger(ID5B);
                        StandB = false;
                        Actions.TurnAroundCheck();
                        Hitboxes.ClearHitBox();
                    }
                }
            }
            else
            {
                if (JumpB)
                {
                    anim.SetTrigger(ID5B);
                    JumpB = false;
                    Hitboxes.ClearHitBox();
                }
            }
            Hitboxes.ClearHitBox();
            breakButton = 0;
        }
        else if (Actions.acceptHeavy && heavyButton > 0 && Move.HitDetect.hitStop <= 0)
        {
            //heavy attacks
            if (Actions.standing)
            {
                if (MaxInput.GetAxis(Vertical) < 0)
                {
                    if (CrouchH)
                    {
                        anim.SetTrigger(ID2H);
                        CrouchH = false;
                    }
                }
                else
                {
                    if (StandH)
                    {
                        anim.SetTrigger(ID5H);
                        StandH = false;
                    }
                }
            }
            else
            {
                if (JumpH)
                {
                    anim.SetTrigger(ID5H);
                    JumpH = false;
                }
            }
            Hitboxes.ClearHitBox();
            heavyButton = 0;
        }
        else if (Actions.acceptMedium && mediumButton > 0 && Move.HitDetect.hitStop <= 0)
        {
            //medium attacks
            if (Actions.standing)
            {
                if (MaxInput.GetAxis(Vertical) < 0)
                {
                    if (CrouchM)
                    {
                        anim.SetTrigger(ID2M);
                        CrouchM = false;
                    }
                }
                else
                {
                    if (StandM)
                    {
                        anim.SetTrigger(ID5M);
                        StandM = false;
                    }
                }
            }
            else
            {
                if (JumpM)
                {
                    anim.SetTrigger(ID5M);
                    JumpM = false;
                }
            }
            Hitboxes.ClearHitBox();
            mediumButton = 0;
        }
        else if (Actions.acceptLight && lightButton > 0 && Move.HitDetect.hitStop <= 0)
        {
            //light attacks
            if (Actions.standing)
            {
                if (MaxInput.GetAxis(Vertical) < 0)
                {
                    if (CrouchL > 0)
                    {
                        anim.SetTrigger(ID2L);
                        CrouchL--;
                    }
                }
                else
                {
                    if (StandL)
                    {
                        if (CrouchL < 3)
                        {
                            CrouchL = 0;
                        }
                        anim.SetTrigger(ID5L);
                        StandL = false;
                    }
                }
            }
            else
            {
                if (JumpL > 0)
                {
                    anim.SetTrigger(ID5L);
                    JumpL--;
                }
            }
            Hitboxes.ClearHitBox();
            lightButton = 0;
        }

        // ACH character specific, can charge or delay certain special attacks
        if (MaxInput.GetButton(Break))
        {
            anim.SetBool(BreakCharge, true);

            if (currentState.IsName("StarfallDelay"))
            {
                Hitboxes.HitDetect.rb.gravityScale = .35f * Hitboxes.HitDetect.Actions.originalGravity;
            }
        }
        else
        {
            anim.SetBool(BreakCharge, false);
        }
    }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        currentState = anim.GetCurrentAnimatorStateInfo(0);
        anim.SetFloat(yVeloID, rb.velocity.y);

        // rotate based on position relative to opponent
        if (facingRight && transform.eulerAngles != Vector3.zero)
        {
            transform.eulerAngles = Vector3.zero;
        }
        else if (!facingRight && transform.eulerAngles != new Vector3(0, 180, 0))
        {
            transform.eulerAngles = new Vector3(0, 180, 0);
        }

        if (transform.position.x < -9.935f && !Actions.grabbed)
        {
            transform.position = new Vector3(-9.935f, transform.position.y, transform.position.z);
        }
        else if (transform.position.x > 9.935f && !Actions.grabbed)
        {
            transform.position = new Vector3(9.935f, transform.position.y, transform.position.z);
        }

        if (Actions.acceptMove && Actions.standing)
        {
            if (opponent.transform.position.x < transform.position.x - .1f)
            {
                facingRight = false;
            }
            else if (opponent.transform.position.x > transform.position.x + .1f)
            {
                facingRight = true;
            }
        }

        if (anim.GetBool(KOID) || RoundManager.lockInputs)
        {
            anim.SetBool(crouchID, false);
            anim.SetBool(walkFID, false);
            anim.SetBool(walkBID, false);
            anim.SetBool(runID, false);
        }

        if (!Actions.airborne)
        {
            pushBox.offset = pushCenter;
            pushBox.size   = pushSize;
        }
        else if (currentState.IsName("WallStick"))
        {
            pushBox.offset = pushCenter;
            pushBox.size   = pushSize;
        }
        else
        {
            anim.SetBool(crouchID, false);
            anim.SetBool(runID, false);

            pushBox.offset = airPushCenter;
            pushBox.size   = airPushSize;

            if (rb.velocity.y < 0)
            {
                pushBox.offset = pushCenter;
                pushBox.size   = pushSize;
            }

            if (jumps == 0)
            {
                jumps = 1;
            }
        }

        pushTrigger.offset = new Vector2(pushBox.offset.x, pushBox.offset.y);
        pushTrigger.size   = new Vector2(pushBox.size.x, pushBox.size.y + .3f);

        if (transform.position.x < -9.935f)
        {
            transform.position = new Vector3(-9.935f, transform.position.y, transform.position.z);
        }
        else if (transform.position.x > 9.935f)
        {
            transform.position = new Vector3(9.935f, transform.position.y, transform.position.z);
        }

        if (transform.position.y < minPosY)
        {
            transform.position = new Vector3(transform.position.x, minPosY, transform.position.z);
            Actions.airborne   = false;
        }
        else if (transform.position.y > 1.2f)
        {
            Actions.airborne = true;
        }

        if (RoundManager.gameActive && !RoundManager.lockInputs && !HitDetect.pauseScreen.isPaused)
        {
            if (HitDetect.hitStop <= 0)
            {
                if ((MaxInput.GetAxis(Vertical) < 0 && Actions.acceptMove && Actions.standing) || (anim.GetBool(crouchID) && !Actions.acceptMove && Actions.standing))
                {
                    anim.SetBool(crouchID, true);
                }
                else
                {
                    anim.SetBool(crouchID, false);
                }

                if (Actions.acceptMove && Actions.standing && !anim.GetBool(crouchID) && ((MaxInput.GetAxis(Horizontal) > 0 && facingRight) || (MaxInput.GetAxis(Horizontal) < 0 && !facingRight)) && !Actions.airborne && !anim.GetBool(runID))
                {
                    anim.SetBool(walkFID, true);
                }
                else
                {
                    anim.SetBool(walkFID, false);
                }

                if (Actions.acceptMove && Actions.standing && !anim.GetBool(crouchID) && ((MaxInput.GetAxis(Horizontal) < 0 && facingRight) || (MaxInput.GetAxis(Horizontal) > 0 && !facingRight)) && !Actions.airborne && !backDash)
                {
                    if ((GameObject.Find("PracticeModeManager").GetComponent <PracticeMode>().dummyState == "StandGuard" ||
                         GameObject.Find("PracticeModeManager").GetComponent <PracticeMode>().dummyState == "GuardAll") && transform.parent.name == "Player2")
                    {
                        anim.SetBool(walkBID, false);
                    }
                    else
                    {
                        anim.SetBool(walkBID, true);
                    }
                }
                else
                {
                    anim.SetBool(walkBID, false);
                }

                DoubleTapActions();

                if ((Actions.acceptMove && jumps == 0 && MaxInput.GetAxis(Vertical) > 0 && Actions.standing) ||
                    (Actions.jumpCancel && jumps < maxJumps && MaxInput.GetAxis(Vertical) > 0 && !vertAxisInUse))
                {
                    if (jumps > 0)
                    {
                        sigil.GetComponent <Sigil>().colorChange = 0;
                        sigil.GetComponent <Sigil>().scaleChange = 0;
                        sigil.transform.position    = new Vector3(transform.position.x, transform.position.y + .5f * pushBox.offset.y - .5f * pushBox.size.y, transform.position.z);
                        sigil.transform.eulerAngles = new Vector3(75, 0, 0);
                    }

                    Actions.DisableAll();
                    pushBox.isTrigger = true;
                    jumps++;
                    jumping            = .3f;
                    Actions.recovering = true;


                    if (MaxInput.GetAxis(Horizontal) > 0 && !anim.GetBool(runID))
                    {
                        jumpRight = true;
                        sigil.transform.eulerAngles = new Vector3(60, -40, 0);
                    }
                    else if (MaxInput.GetAxis(Horizontal) < 0 && !anim.GetBool(runID))
                    {
                        jumpLeft = true;
                        sigil.transform.eulerAngles = new Vector3(60, 40, 0);
                    }


                    vertAxisInUse = true;
                }
            }
        }
        else
        {
            Actions.DisableAll();
            Actions.DisableBlitz();
        }

        if (currentState.IsName("GroundBounce") || Actions.airborne)
        {
            anim.ResetTrigger(KDID);
        }
        if (MaxInput.GetAxisRaw(Vertical) == 0)
        {
            vertAxisInUse = false;
        }
        if (MaxInput.GetAxisRaw(Horizontal) == 0)
        {
            horiAxisInUse   = false;
            justDefenseTime = 5;
        }

        if ((opponent.position.x > transform.position.x && MaxInput.GetAxis(Horizontal) < 0) || (opponent.position.x < transform.position.x && MaxInput.GetAxis(Horizontal) > 0))
        {
            justDefenseTime--;
        }

        Blocking();
        WallStick();
    }