public void SetupPlayerAttackMotions(SO_CharAtk_Motion sOCharAtkMotion) { if (curSlow != 0f) { charMov.ReduceSpeed(-curSlow); } // Get references from the Scriptable Object. durations = sOCharAtkMotion.durations; distances = sOCharAtkMotion.distances; lockInputMovement = sOCharAtkMotion.lockInputMovement; lockCharacterAndWeapon = sOCharAtkMotion.lockCharacterAndWeapon; slowDownRunSpeed = sOCharAtkMotion.slowDownRunSpeed; //chargeAttack = sOCharAtkMotion.chargeAttack; loopMotions = sOCharAtkMotion.loopMotion; //loopFinalMotion = sOCharAtkMotion.loopFinalMotion; // Assign the current values for the first motion. // *Could run SetupNextMotionNow with a few changes? curMotion = 0; curDistance = distances[curMotion]; curDuration = durations[curMotion]; curDirection = weapOrigTrans.up; curSpeed = Mathf.Abs(curDistance / curDuration); if (curDistance < 0) { curDirection *= -1; } curPosition = weapOrigTrans.position; curSlow = slowDownRunSpeed[curMotion]; // Set initial locks and slowdown. // Locks the player movement input. if (lockInputMovement[curMotion]) { charMov.StopInputMove(); } else { charMov.canInputMove = true; } // This locks the character sprite flip and weapon rotation. (Can be seperated) if (lockCharacterAndWeapon[curMotion]) { charMov.charCanFlip = false; weaponLookAt.lookAtEnabled = false; } else { charMov.charCanFlip = true; weaponLookAt.lookAtEnabled = true; } // Applies a slow to the player input movement speed. charMov.ReduceSpeed(curSlow); finalMotion = false; exitPlayerMotion = false; moveTimer = 0f; if (curMotion < loopMotions.Length - 1 && loopMotions[curMotion]) { finalMotion = true; } this.StopAllCoroutines(); charAtkMotionOn = true; this.StartCoroutine(CharAttackMotionTimer()); }