public void ChainAttacks()
    {
        // This attack is the last in the chain. Code based on that can be added here.
        if (nextChain >= charAtk.weapon.attackChains.Length)
        {
            nextChain = 0;
        }
        curChain = nextChain;
        // Turn this chain reset timer to 0 after the attack is complete.
        if (chainResetTimerCoroutine != null)
        {
            StopCoroutine(chainResetTimerCoroutine);
        }
        chainResetTimerCoroutine = null;

        charAtk.ReadyToAttack(false);
        charAtk.equippedWeapons.canSwapWeapon = false;
        if (atkDurCoroutine != null)
        {
            StopCoroutine(atkDurCoroutine);
        }
        if (atkChainCooldownCoroutine != null)
        {
            StopCoroutine(atkChainCooldownCoroutine);
        }
        atkDurCoroutine = StartCoroutine(FullAttackDuration());
        nextChain++;
    }
 public void StopMovementSkill()
 {
     dashing = false;
     charMove.canInputMove = true;
     charMove.charCanFlip  = true;
     charAttack.ReadyToAttack(true);
     //charAttack.readyToAtk = true;
 }
示例#3
0
 public void StopTakeHit()
 {
     // If health reaches 0, iniate death sequence.
     if (currentHealth <= 0f)
     {
         charDeath.CharacterDies();
     }
     else
     {
         charMov.canInputMove = true;
         //charAtk.atkChain.ready = true;
         charAtk.ReadyToAttack(true);
         //charAtk.readyToAtk = true;
         weapLookAt.lookAtEnabled = true;
         charMov.charCanFlip      = true;
         charMov.StartIdling();
     }
 }
 public void BreakActiveWeapon()
 {
     // Remove from HUD with appropriate effects.
     HUDManager.playerWeapons.RemoveBrokenWeapon();
     // Remove from player with appropriate in-game effects and change the active weapon.
     StartCoroutine(SpawnWeaponPieces(activeWeapon.SO_brokenPiecesSpawner, Vector2.zero));
     // Change weapon. Anything that requires the active weapon that just broke should be done before this.
     activeWeapon   = inactiveWeapon;
     inactiveWeapon = null;
     if (activeWeapon != null)
     {
         WeaponSwap(true);
         // HUD active weapon changes.
         HUDManager.playerWeapons.SwapActiveWeapon();
     }
     else
     {
         // No more weapons, what now?
         charAtk.weapon       = null; // Shouldn't change this externally probably.
         weaponSpriteR.sprite = null;
     }
     // Allow the player to attack since the last attack of the weapon that broke was maybe not allowed to finish. Could set a delay for this to the time it would of taken to finish the last attack if it wasn't completed when the weapon broke.
     charAtk.ReadyToAttack(true);
 }
    public void SpecialAttack()
    {
        charAtk.ReadyToAttack(false);
        mainSpecialSO = charAtk.weapon;

        SO_WindupFX[0] = mainSpecialSO.specialAttack.sO_AttackFXWindup[0];
        SO_HoldFX[0]   = mainSpecialSO.specialAttack.sO_AttackFXHold[0];
        //print(mainSpecialSO.specialAttack.sO_AttackFXRelease.Length);
        SO_ReleaseFX.Clear();
        for (int i = 0; i < mainSpecialSO.specialAttack.sO_AttackFXRelease.Length; i++)
        {
            //print("HELLO");
            if (i >= SO_ReleaseFX.Count)
            {
                SO_ReleaseFX.Add(mainSpecialSO.specialAttack.sO_AttackFXRelease[i]);
            }
            else
            {
                SO_ReleaseFX[i] = mainSpecialSO.specialAttack.sO_AttackFXRelease[i];
            }
        }

        SO_WindupCharMo = mainSpecialSO.specialAttack.sO_CharAtk_Motion;
        sOWeapoMo       = mainSpecialSO.specialAttack.sO_Weapon_Motion;

        // Perform the special attack.
        // If the attack is triggered, make sure that the grace period is set back to false since it is used.
        moIn.attackButtonActions.attackButtonTapInGrace = false;
        // Disallow weapon swapping.
        charAtk.equippedWeapons.canSwapWeapon = false;
        // Stop the previous motion if needed.
        charAtk.StopPreviousMotion();
        // Set the weapon back to its resting position and rotation. Usually the first attack chain's resting values.
        charAtk.ResetWeaponLocalValues();
        // Allow character flip and the weapon to "look at" the mouse.
        charAtk.ForceCharFlipAndWeaponLookAt();
        weaponMotion = charAtk.weaponMotionController.CheckMotionList(sOWeapoMo.weapon_Motion);
        //windupFX = null;
        //holdFX = null;
        //releaseFX = null;
        releaseFX.Clear();
        windupFX[0]       = charAtk.atkFXPool.RequestAttackFX();
        windupFX[0].inUse = true;
        holdFX[0]         = charAtk.atkFXPool.RequestAttackFX();
        holdFX[0].inUse   = true;
        for (int i = 0; i < SO_ReleaseFX.Count; i++)
        {
            if (i >= releaseFX.Count)
            {
                releaseFX.Add(charAtk.atkFXPool.RequestAttackFX());
            }
            else
            {
                releaseFX[i] = charAtk.atkFXPool.RequestAttackFX();
            }
            releaseFX[i].inUse = true;
        }

        if (specialAtkCoroutine != null)
        {
            specialAtkCoroutine = null;
        }
        specialAtkCoroutine = StartCoroutine(InSpecialAttack());
    }