small anim fixes
This commit is contained in:
@@ -95,9 +95,9 @@ AnimatorStateTransition:
|
|||||||
m_Mute: 0
|
m_Mute: 0
|
||||||
m_IsExit: 0
|
m_IsExit: 0
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransitionDuration: 0.25
|
m_TransitionDuration: 0
|
||||||
m_TransitionOffset: 0
|
m_TransitionOffset: 0
|
||||||
m_ExitTime: 0.88805974
|
m_ExitTime: 0.000000001239959
|
||||||
m_HasExitTime: 0
|
m_HasExitTime: 0
|
||||||
m_HasFixedDuration: 1
|
m_HasFixedDuration: 1
|
||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
@@ -168,31 +168,31 @@ AnimatorController:
|
|||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 0}
|
m_Controller: {fileID: 9100000}
|
||||||
- m_Name: Fall
|
- m_Name: Fall
|
||||||
m_Type: 4
|
m_Type: 4
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 0}
|
m_Controller: {fileID: 9100000}
|
||||||
- m_Name: velX
|
- m_Name: velX
|
||||||
m_Type: 1
|
m_Type: 1
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 0}
|
m_Controller: {fileID: 9100000}
|
||||||
- m_Name: WalkVelocity
|
- m_Name: WalkVelocity
|
||||||
m_Type: 1
|
m_Type: 1
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 0}
|
m_Controller: {fileID: 9100000}
|
||||||
- m_Name: SitDown
|
- m_Name: SitDown
|
||||||
m_Type: 4
|
m_Type: 4
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 0}
|
m_Controller: {fileID: 9100000}
|
||||||
m_AnimatorLayers:
|
m_AnimatorLayers:
|
||||||
- serializedVersion: 5
|
- serializedVersion: 5
|
||||||
m_Name: Base Layer
|
m_Name: Base Layer
|
||||||
@@ -393,7 +393,10 @@ AnimatorStateTransition:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_Conditions: []
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 2
|
||||||
|
m_ConditionEvent: Walk
|
||||||
|
m_EventTreshold: 0
|
||||||
m_DstStateMachine: {fileID: 0}
|
m_DstStateMachine: {fileID: 0}
|
||||||
m_DstState: {fileID: -5486930935274134635}
|
m_DstState: {fileID: -5486930935274134635}
|
||||||
m_Solo: 0
|
m_Solo: 0
|
||||||
@@ -403,7 +406,7 @@ AnimatorStateTransition:
|
|||||||
m_TransitionDuration: 0.25
|
m_TransitionDuration: 0.25
|
||||||
m_TransitionOffset: 0
|
m_TransitionOffset: 0
|
||||||
m_ExitTime: 0.96153843
|
m_ExitTime: 0.96153843
|
||||||
m_HasExitTime: 1
|
m_HasExitTime: 0
|
||||||
m_HasFixedDuration: 1
|
m_HasFixedDuration: 1
|
||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -34261,7 +34261,7 @@ AnimationClip:
|
|||||||
m_LoopBlend: 0
|
m_LoopBlend: 0
|
||||||
m_LoopBlendOrientation: 0
|
m_LoopBlendOrientation: 0
|
||||||
m_LoopBlendPositionY: 0
|
m_LoopBlendPositionY: 0
|
||||||
m_LoopBlendPositionXZ: 0
|
m_LoopBlendPositionXZ: 1
|
||||||
m_KeepOriginalOrientation: 0
|
m_KeepOriginalOrientation: 0
|
||||||
m_KeepOriginalPositionY: 0
|
m_KeepOriginalPositionY: 0
|
||||||
m_KeepOriginalPositionXZ: 0
|
m_KeepOriginalPositionXZ: 0
|
||||||
|
|||||||
+20
-29
@@ -83,51 +83,40 @@ public class Player : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private TaskStatus MoveToPoint()
|
private TaskStatus MoveToPoint()
|
||||||
{
|
{
|
||||||
|
SetPlayerState(ActionStates.Walking);
|
||||||
|
|
||||||
var worldDeltaPosition = _navAgent.nextPosition - transform.position;
|
var worldDeltaPosition = _navAgent.nextPosition - transform.position;
|
||||||
_groundDeltaPosition.x = Vector3.Dot(transform.right, worldDeltaPosition);
|
_groundDeltaPosition.x = Vector3.Dot(transform.right, worldDeltaPosition);
|
||||||
_groundDeltaPosition.y = Vector3.Dot(transform.forward, worldDeltaPosition);
|
_groundDeltaPosition.y = Vector3.Dot(transform.forward, worldDeltaPosition);
|
||||||
|
|
||||||
Vector2 velocity = (Time.deltaTime > 1e-5f) ? _groundDeltaPosition / Time.deltaTime : Vector2.zero;
|
Vector2 velocity = (Time.deltaTime > 1e-5f) ? _groundDeltaPosition / Time.deltaTime : Vector2.zero;
|
||||||
var shouldMove = velocity.magnitude > 0.025f && _navAgent.remainingDistance > _navAgent.radius;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (_currentState == ActionStates.Sitting)
|
|
||||||
{
|
|
||||||
SetPlayerState(ActionStates.Standing);
|
|
||||||
|
|
||||||
}
|
|
||||||
_currentState = shouldMove ? ActionStates.Walking : ActionStates.Idle;
|
|
||||||
|
|
||||||
SetPlayerState(ActionStates.Walking);
|
|
||||||
_animator.SetFloat(WALK_VELOCITY, velocity.y);
|
_animator.SetFloat(WALK_VELOCITY, velocity.y);
|
||||||
|
|
||||||
return pathComplete(_navAgent.destination) ? TaskStatus.Complete : TaskStatus.InProgress;
|
return pathComplete(_navAgent.destination) ? TaskStatus.Complete : TaskStatus.InProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool pathComplete(Vector3 destination)
|
||||||
|
{
|
||||||
|
if (Vector3.Distance(destination, _navAgent.transform.position) <= _navAgent.radius)
|
||||||
|
{
|
||||||
|
if (!_navAgent.hasPath || _navAgent.velocity.sqrMagnitude == 0f)
|
||||||
|
{
|
||||||
|
SetPlayerState(ActionStates.Idle);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void Rotate(Vector3 target)
|
public void Rotate(Vector3 target)
|
||||||
{
|
{
|
||||||
Quaternion rotation = Quaternion.LookRotation(target);
|
Quaternion rotation = Quaternion.LookRotation(target);
|
||||||
transform.rotation = rotation;
|
transform.rotation = rotation;
|
||||||
}
|
}
|
||||||
private bool pathComplete(Vector3 destination)
|
|
||||||
{
|
|
||||||
if (Vector3.Distance(destination, _navAgent.transform.position) <= _navAgent.radius)
|
|
||||||
{
|
|
||||||
if (!_navAgent.hasPath || _navAgent.velocity.sqrMagnitude == 0f)
|
|
||||||
{
|
|
||||||
SetPlayerState(ActionStates.Idle);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private TaskStatus InteractWithObject(BaseInteractableObject interactableObject)
|
private TaskStatus InteractWithObject(BaseInteractableObject interactableObject)
|
||||||
{
|
{
|
||||||
@@ -137,6 +126,8 @@ public class Player : MonoBehaviour
|
|||||||
|
|
||||||
public void SetPlayerState(ActionStates newState)
|
public void SetPlayerState(ActionStates newState)
|
||||||
{
|
{
|
||||||
|
if(newState== _currentState)
|
||||||
|
{ return; }
|
||||||
switch (newState)
|
switch (newState)
|
||||||
{
|
{
|
||||||
case ActionStates.Idle:
|
case ActionStates.Idle:
|
||||||
|
|||||||
Reference in New Issue
Block a user