Esempio n. 1
0
        int CalculateProration(int amount)
        {
            if (state.GetState() == FighterState.hitstun)
            {
                // in combo
                if (comboProration > .4f)
                {
                    comboProration -= .1f;
                }
                amount = (int)(amount * comboProration);
            }
            else
            {
                comboHits      = 1;
                comboProration = 1;
            }

            return(amount);
        }
Esempio n. 2
0
        //
        // returns true if attack is successful and false if it has 'missed' eg invincible
        public bool ProcessHit(Hitbox hitData, Vector2 hitPoint)
        {
            bool successfulHit = true;

            if (!(hitData.moveMasterID == previousHitData.moveMasterID && hitData.moveCurrentUseID == previousHitData.moveCurrentUseID))
            {
                if (hitData.attackProperty == AttackProperty.Throw && (state.GetState() != FighterState.jumping || state.GetState() != FighterState.jumpingAttack ||
                                                                       state.GetState() != FighterState.hitstun || state.GetState() != FighterState.blockstun))
                {
                    // successful throw
                    // play throw animation and attack

                    actionManager.StartHitstun(hitData.hitstun, 0, Vector2.Zero, true);


                    state.SetState(FighterState.invincible);
                    if (hitData.throwType == ThrowType.chun)
                    {
                        attackPlayer.StartAttack(chunLiThrow, FighterAnimations.chunliThrow);
                        actionManager.StartDelayedDamage(hitData.damage, 30);
                    }

                    // deal damage on delay

                    // play sound
                    MasterSound.grab.Play();
                }
                else if (state.GetState() == FighterState.neutral && state.CheckIfBlocking() || state.GetState() == FighterState.blockstun)
                {
                    // successful blocking
                    actionManager.CancelActions();
                    actionManager.StartBlockstun(hitData.hitstun, hitData.pushbackDuration, hitData.pushback, hitData.ignorePushback);

                    state.SetState(FighterState.blockstun);
                    health.DealDamage(hitData.chipDamage, true);
                    animator.PlayAnimation(FighterAnimations.blocking);
                }
                else if (state.GetState() != FighterState.invincible)
                {
                    // successful hit

                    actionManager.CancelActions();
                    MasterObjectContainer.hitstopRemaining = hitData.hitStop;
                    actionManager.StartHitstun(hitData.hitstun, hitData.pushbackDuration, hitData.pushback, hitData.ignorePushback);

                    int amount = health.DealDamage(hitData.damage);
                    superMeter.AddMeter((int)(hitData.damage * 1.3f));


                    if (state.GetState() == FighterState.jumping || state.GetState() == FighterState.jumpingAttack || state.GetState() == FighterState.airHitstun || hitData.attackProperty == AttackProperty.Launcher || health.GetHealth() <= 0)
                    {
                        state.SetState(FighterState.airHitstun);
                        animator.PlayAnimation(FighterAnimations.airHit, true);
                    }
                    else
                    {
                        state.SetState(FighterState.hitstun);
                        animator.PlayAnimation(FighterAnimations.hit, true);
                    }



                    if (hitData.attackStrength == HitSpark.light)
                    {
                        lightHitSparks.Get().Play(hitPoint);
                        MasterSound.hitLight.Play();
                    }
                    else if (hitData.attackStrength == HitSpark.medium)
                    {
                        mediumHitSparks.Get().Play(hitPoint);
                        MasterSound.hitMedium.Play();
                    }
                    else if (hitData.attackStrength == HitSpark.heavy)
                    {
                        heavyHitSparks.Get().Play(hitPoint);
                        MasterSound.hitHard.Play();
                    }
                    else if (hitData.attackStrength == HitSpark.special)
                    {
                        specialHitSparks.Get().Play(hitPoint);
                        MasterSound.hitHard.Play();
                    }
                    // cancel other active moves
                    // set state to hitstun
                    //
                }
                else
                {
                    successfulHit = false;
                }
            }
            else
            {
                successfulHit = false;
            }
            previousHitData = hitData;

            return(successfulHit);
        }
Esempio n. 3
0
        // take in stick position and move character accordingly
        void ProcessMovement()
        {
            // quit out if not in the neutral state
            if (state.GetState() != FighterState.neutral)
            {
                return;
            }

            Vector2 inputAxis = input.GetLeftStick();

            // jump movement block
            if (inputAxis.Y > .5f)
            {
                state.ProcessFacingDirection();
                if (inputAxis.X > DeadSize)
                {
                    // jump right
                    jumpForward();
                }
                else if (inputAxis.X < -DeadSize)
                {
                    // jump left
                    jumpBack();
                }
                else
                {
                    // jump up
                    jumpNeutral();
                }
            }
            else if (Math.Abs(inputAxis.X) > DeadSize)
            {
                // left right movement block

                int direction = 0;
                // check if left or right movement
                if (inputAxis.X > 0)
                {
                    if (state.GetFacingDirection())
                    {
                        spriteAnimator.PlayAnimation(FighterAnimations.walkBack);
                    }
                    else
                    {
                        spriteAnimator.PlayAnimation(FighterAnimations.walkToward);
                    }
                    direction = 1;
                }
                else
                {
                    if (state.GetFacingDirection())
                    {
                        spriteAnimator.PlayAnimation(FighterAnimations.walkToward);
                    }
                    else
                    {
                        spriteAnimator.PlayAnimation(FighterAnimations.walkBack);
                    }
                    direction = -1;
                }
                TryMove(new Vector2(direction * speed, 0));
            }
            else
            {
                spriteAnimator.PlayAnimation(FighterAnimations.neutral);
            }
        }
Esempio n. 4
0
        void HitstunUpdate()
        {
            if (state.GetState() == FighterState.hitstun)
            {
                // stun that the player is pushed back during
                if (stunMovementRemaining > 0)
                {
                    if (transform.position.X >= Camera.GetBound() || transform.position.X <= Camera.GetBound(false) && !ignoreCornerPushback)
                    {
                        playerMovement.otherPlayerMovement.MoveTowards(movementStepSize);
                    }
                    else
                    {
                        playerMovement.MoveTowards(movementStepSize);
                    }
                    stunMovementRemaining--;
                }


                //regular hitstun
                if (hitstunRemaining <= 0)
                {
                    UIMatch.HideComboText(state.isPlayerOne());
                    state.SetState(FighterState.neutral);
                }
                hitstunRemaining--;
            }
            else if (state.GetState() == FighterState.airHitstun)
            {
                if (stunMovementRemaining > 0)
                {
                    playerMovement.MoveTowards(movementStepSize);
                    stunMovementRemaining--;
                }
                else
                {
                    playerMovement.MoveTowards(new Vector2(0, -10));
                    if (transform.position.Y <= playerMovement.groundBound)
                    {
                        // hitground
                        groundRecoveryRemaining = 80;
                        if (health.GetHealth() <= 0)
                        {
                            animator.PlayAnimation(FighterAnimations.deathKnockdown);
                        }
                        else
                        {
                            UIMatch.HideComboText(state.isPlayerOne());
                            animator.PlayAnimation(FighterAnimations.knockdown);
                        }
                        state.SetState(FighterState.invincible);
                    }
                }
            }
            else if (state.GetState() == FighterState.blockstun)
            {
                if (stunMovementRemaining > 0)
                {
                    playerMovement.MoveTowards(movementStepSize);
                    stunMovementRemaining--;
                }
                if (blockstunRemaining <= 0)
                {
                    state.SetState(FighterState.neutral);
                }
                blockstunRemaining--;
            }
        }