Ejemplo n.º 1
0
 public Projectile(Hitbox hitData)
 {
     this.hitData = hitData;
     hitboxColor  = new Color(Color.Red, .5f);
 }
Ejemplo 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);
        }
Ejemplo n.º 3
0
 public void setAttack(Hitbox hitbox)
 {
     this.hitbox = hitbox;
     isAttack    = true;
 }