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());
    }
예제 #2
0
 // public abstract void ResetWeaponRotation(Transform weapTrans);
 // public abstract void AttackWeaponMotion(float curTimer, Transform weapTrans);
 public abstract void WeaponMotionSetup(Character_Attack _charAtk, Transform _weaponTrans, SpriteRenderer _weaponSpriteR, SO_Weapon_Motion specialSOWeapMo = null);
 public override void WeaponMotionSetup(Character_Attack _charAtk, Transform _weaponTrans, SpriteRenderer _weaponSpriteR, SO_Weapon_Motion specialSOWeapMo = null)
 {
     // References from the character.
     weaponTrans   = _weaponTrans;
     weaponSpriteR = _weaponSpriteR;
     charAtk       = _charAtk;
     if (specialSOWeapMo != null)
     {
         sOWeaponMotionStab = specialSOWeapMo as SO_Weapon_Motion_Stab;
     }
     else
     {
         // References from the motion SO associated with the current attack chain.
         sOWeaponMotionStab = charAtk.weapon.attackChains[charAtk.atkChain.curChain].sO_Weapon_Motion as SO_Weapon_Motion_Stab;
     }
     motionDurations = sOWeaponMotionStab.motionDurations;
     yPositions      = sOWeaponMotionStab.yPositions;
     animCurves      = sOWeaponMotionStab.animCurves;
     restingY        = sOWeaponMotionStab.restingPosition.y;
     holdMotions     = sOWeaponMotionStab.holdMotions;
     curMotion       = 0;
     // First motion setup.
     curMotionDur = motionDurations[curMotion];
     startYPos    = restingY;
     endYPos      = yPositions[curMotion];
     curAnimCurve = animCurves[curMotion];
     moveTimer    = 0f;
     camNudged    = false;
     if (curMotion < holdMotions.Length - 1 && holdMotions[curMotion])
     {
         curHoldMotion = true;
     }
     else
     {
         curHoldMotion = false;
     }
     // Enable motion.
     resetWeapRot = false;
     weapMotionOn = true;
     //
     weaponTrans.localPosition = sOWeaponMotionStab.restingPosition;
     weaponTrans.localRotation = Quaternion.Euler(sOWeaponMotionStab.restingRotation);
 }
예제 #4
0
    public override void WeaponMotionSetup(Character_Attack _charAtk, Transform _weaponTrans, SpriteRenderer _weaponSpriteR, SO_Weapon_Motion specialSOWeapMo = null)
    {
        // References from the character.
        weaponTrans   = _weaponTrans;
        weaponSpriteR = _weaponSpriteR;
        charAtk       = _charAtk;
        // References from the motion SO associated with the current attack chain.
        sOWeaponMotionSlash = charAtk.weapon.attackChains[charAtk.atkChain.curChain].sO_Weapon_Motion as SO_Weapon_Motion_Slash;
        motionDurations     = sOWeaponMotionSlash.motionDurations;
        // Clone makes the new array a "shallow" reference, meaning making changes to the new array wont change the original one, it just copies the values as opposed to being a reference to the array.
        rotations       = sOWeaponMotionSlash.rotations.Clone() as float[];
        animCurves      = sOWeaponMotionSlash.animCurves;
        restingRotation = sOWeaponMotionSlash.restingRotation.z;
        curMotion       = 0;
        // First motion setup.
        if (sOWeaponMotionSlash.useDirectionChange)
        {
            DirectionChange();
        }
        else if (sOWeaponMotionSlash.followPlayerOrientation)
        {
            // flip the rotation if player is looking right. may depend on rotation and weapon FX visuals
            AllignWithPlayer();
            charAtk.atkFollowPlayerOrientation = true;
        }
        startRot = restingRotation;
        endRot   = rotations[curMotion];

        curMotionDur = motionDurations[curMotion];
        curAnimCurve = animCurves[curMotion];
        camNudged    = false;
        // Enable motion.
        StopAllCoroutines();
        StartCoroutine(WeaponMotionOn());
        resetWeapOn = false;
        //weapMotionOn = true;
        moveTimer = 0f;
        if (sOWeaponMotionSlash.useDirectionChange)
        {
            sOWeaponMotionSlash.clockwise = !sOWeaponMotionSlash.clockwise;
        }
        //
        //weaponTrans.localPosition = sOWeaponMotionSlash.restingPosition;
        //weaponTrans.localRotation = Quaternion.Euler(sOWeaponMotionSlash.restingRotation);
    }