Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Dash : Ability
- {
- protected override void AbilityStarted()
- {
- base.AbilityStarted();
- var vel = new Vector3(m_CharacterLocomotion.LocomotionVelocity.x, 0 , m_CharacterLocomotion.LocomotionVelocity.z);
- var lookDir = m_CharacterLocomotion.LookSource.LookDirection(false);
- var lookDirNoY = new Vector3(lookDir.x, 0, lookDir.z);
- var inputForce = new Vector3(m_CharacterLocomotion.InputVector.x, 0, m_CharacterLocomotion.InputVector.y);
- if (inputForce.x != 0)
- {
- AddForce(vel.normalized * 50);
- return;
- }
- if (inputForce.z < 0) //Back - not a good solution, Id rather use vel.normalized
- {
- AddForce(-m_CharacterLocomotion.transform.forward * 50);
- return;
- }
- if (inputForce.z > 0) //Forward
- {
- AddForce(lookDirNoY * 60);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement