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); }
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); }
// 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);