This commit is contained in:
kimrdd 2024-02-03 15:45:11 +01:00
parent 99e6b8c519
commit dd9b264927
4 changed files with 19 additions and 17 deletions

View File

@ -47,7 +47,7 @@ AnimatorStateTransition:
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
@ -85,7 +85,7 @@ AnimatorStateMachine:
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 280, y: 90, z: 0}
m_AnyStatePosition: {x: 300, y: 70, z: 0}
m_EntryPosition: {x: 20, y: 160, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
@ -111,7 +111,7 @@ AnimatorStateTransition:
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
@ -136,7 +136,7 @@ AnimatorStateTransition:
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
@ -265,7 +265,7 @@ AnimatorStateTransition:
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
@ -290,7 +290,7 @@ AnimatorStateTransition:
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1

View File

@ -129,31 +129,31 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: Run
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: Mop
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: Swing
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: RunMop
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer

View File

@ -5,20 +5,19 @@ using UnityEngine.InputSystem;
public class RumbleManager : MonoBehaviour
{
private Gamepad pad1;
private Gamepad pad2;
private Gamepad pad;
private Coroutine stopRumbleAfterTimeCorutine;
public void RumblePulse(float lowFrequency, float highFrequency, float duration, int player)
{
pad1 = Gamepad.all[0];
if (pad1 != null)
pad = Gamepad.all[player];
if (pad != null)
{
pad1.SetMotorSpeeds(lowFrequency, highFrequency);
pad.SetMotorSpeeds(lowFrequency, highFrequency);
stopRumbleAfterTimeCorutine = StartCoroutine(stopRumble(duration, pad1));
stopRumbleAfterTimeCorutine = StartCoroutine(stopRumble(duration, pad));
}
}

View File

@ -52,7 +52,10 @@ public class PlayerMovement : MonoBehaviour
movement.y = Input.GetAxisRaw("Vertical"); ;
}
if (movement.x != 0 || movement.y != 0)
{
RumbleWalk();
GetComponent<PlayerAnimationHandler>().Run();
}
}
private void FixedUpdate()
{