Пример #1
0
 //Overrides for generic attacks.
 public override void PerformAttack_1()
 {
     if (H_attackTimeCounter < Utils.eps)
     {
         // Begin the animation
         H_animator.SetInteger("AnimationState", 1);
         // Measure the elapsed time.
         H_attackTimeCounter += Time.deltaTime;
         // These boolean variables describe the state the object is in.
         H_ObjectState = ObjectState.Attacking;
         H_canAction   = false;
         H_canDash     = false;
         // Do nothing
     }
     else if (H_attackTimeCounter <= 1.05F)
     {
         H_attackTimeCounter += Time.deltaTime;
     }
     else if (H_attackTimeCounter <= 1.5F)
     {
         H_attackTimeCounter += Time.deltaTime;
         // Initialize the attack.
         if (!H_hasAttacked)
         {
             P_currentAttack = Instantiate(P_attack) as AttackObject;
             BeginAttackState(ref P_currentAttack, 0.2F, 0.2F);
             Move(H_objectDirection, 1.0F, 0.2F);
             P_currentAttack.Scale(0.2F, 1.0F);
             H_hasAttacked = true;
         }
     }
     else if (H_attackTimeCounter <= 1.75F)
     {
         // Initiates another attack, move the combo count up and destroy the current attack.
         H_attackCount       = 1;
         H_attackTimeCounter = 0.0F;
         P_currentAttack.endAttack();
         H_hasAttacked = false;
         H_canAction   = true;
     }
     else
     {
         ResetAttackState();
     }
 }
Пример #2
0
    public override void PerformAttack_1()
    {
        // The attackTimerCounter measures the time since the combo has been started. If it's zero, then
        // the attack needs to be initialized.
        if (H_attackTimeCounter < Utils.eps)
        {
            // Begin the animation
            H_animator.SetInteger("AnimationState", 1);
            // Measure the elapsed time.
            H_attackTimeCounter += Time.deltaTime;
            // These boolean variables describe the state the character is in.
            H_ObjectState     = ObjectState.Attacking;
            H_canAction       = false;
            H_canDash         = false;
            H_inputNextAttack = false;
            H_inputNextSmash  = false;
            // Build Up
        }
        else if (H_attackTimeCounter <= 0.205F)
        {
            H_attackTimeCounter += Time.deltaTime;

            // The player cannot move, but he can dash out or continue the combo.
        }
        else if (H_attackTimeCounter <= 0.350F)
        {
            H_attackTimeCounter += Time.deltaTime;
            // Initialize the attack.
            if (!H_hasAttacked)
            {
                //				P_currentAttack = Instantiate(P_attack) as AttackObject;
                P_currentAttack = P_attack;
                BeginAttackState(ref P_currentAttack, 0.05F, 0.3F);
                P_currentAttack.Scale(0.4F, 1.3F);
                H_hasAttacked = true;
            }
            // If the player initiates another attack, move the combo count up and destroy the current attack.
            if (Input.GetMouseButtonDown(0))
            {
                H_inputNextAttack = true;
            }
            else if (Input.GetMouseButtonDown(1))
            {
                H_inputNextSmash = true;
            }
            H_canDash = true;
        }
        else if (H_attackTimeCounter <= 0.45F)
        {
            H_attackTimeCounter += Time.deltaTime;
            if ((H_inputNextAttack || Input.GetMouseButtonDown(0)) && CheckStamina(10))
            {
                H_attackCount       = 1;
                H_attackTimeCounter = 0.0F;
                P_currentAttack.endAttack();
                H_hasAttacked = false;
            }
            if ((H_inputNextSmash || Input.GetMouseButtonDown(1)) && CheckStamina(25))
            {
                H_attackCount       = 1;
                H_attackTimeCounter = 0.0F;
                P_currentAttack.endAttack();
                H_hasAttacked = false;
                H_ObjectState = ObjectState.Smashing;
            }
        }
        else
        {
            ResetAttackState();
        }
    }