更新
This commit is contained in:
@@ -48,6 +48,32 @@ namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
characterTransform.DOLookAt(target.transform.position, duration, AxisConstraint.Y);
|
||||
}
|
||||
|
||||
public void TurnToDirection(Vector3 direction, float duration = 0f)
|
||||
{
|
||||
Vector3 dashRotation = Vector3.zero;
|
||||
float angle = Vector3.SignedAngle(Vector3.forward, direction, Vector3.up);
|
||||
|
||||
if (owner is Player player)
|
||||
{
|
||||
dashRotation.y = player.viewSc.isLockedOn
|
||||
? player.viewSc.cameraRotationSm.cinemachineEndLockYaw + angle
|
||||
: player.viewSc.cameraRotationSm.cinemachineTargetYaw + angle;
|
||||
}
|
||||
else
|
||||
{
|
||||
dashRotation = new Vector3(0, angle, 0);
|
||||
}
|
||||
|
||||
if (duration > 0)
|
||||
{
|
||||
characterTransform.DORotateQuaternion(Quaternion.Euler(dashRotation), duration);
|
||||
}
|
||||
else
|
||||
{
|
||||
characterTransform.rotation = Quaternion.Euler(dashRotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class MovementSubcontrollerBase
|
||||
|
||||
Reference in New Issue
Block a user