Advertisement
Guest User

Untitled

a guest
Sep 8th, 2023
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using FMOD.Studio;
  5. using UnityEditor.Callbacks;
  6. using UnityEditor.ShaderGraph.Internal;
  7.  
  8. public class FootstepSound : walk
  9. {
  10.  
  11. public FootstepScriptables FootstepScriptablesVariable;
  12. string surface = "";
  13.  
  14.  
  15. void Start()
  16. {
  17. FootstepScriptables.playerWalkingOnConcreteFlat = AudioManager.instance.CreateEventInstance(FModEvents.instance.PlayerWalkingOnConcreteFlat);
  18. FootstepScriptables.playerWalkingOnWoodFlat = AudioManager.instance.CreateEventInstance(FModEvents.instance.PlayerWalkingOnWoodFlat);
  19. FootstepScriptables.PlayerWalkingOnCarpetFlat = AudioManager.instance.CreateEventInstance(FModEvents.instance.PlayerWalkingOnCarpetFlat);
  20. FootstepScriptables.PlayerWalkingOnMetalFlat = AudioManager.instance.CreateEventInstance(FModEvents.instance.PlayerWalkingOnMetalFlat);
  21.  
  22.  
  23. }
  24. void OnTriggerEnter2D(Collider2D collision2DSurface)
  25. {
  26. if (collision2DSurface.gameObject.CompareTag("Concrete"))
  27. {
  28.  
  29. //surface = surface.name;
  30. Debug.Log(surface);
  31.  
  32. }
  33. else if (collision2DSurface.gameObject.CompareTag("Wood"))
  34. {
  35. Debug.Log("Wood");
  36. }
  37.  
  38. }
  39.  
  40.  
  41.  
  42. void FixedUpdate()
  43. {
  44. UpdateSound();
  45. }
  46.  
  47. void UpdateSound()
  48. {
  49.  
  50. if (tristanovement.x != 0 || tristanovement.y != 0)
  51. {
  52. PLAYBACK_STATE playbackStateConcreteWalkFlat;
  53. FootstepScriptables.playerWalkingOnConcreteFlat.getPlaybackState(out playbackStateConcreteWalkFlat);
  54. if (playbackStateConcreteWalkFlat.Equals(PLAYBACK_STATE.STOPPED))
  55. {
  56. FMOD.RESULT result = FootstepScriptables.playerWalkingOnConcreteFlat.start();
  57. }
  58. }
  59. else
  60. {
  61. FMOD.RESULT result = FootstepScriptables.playerWalkingOnConcreteFlat.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
  62. if (result != FMOD.RESULT.OK)
  63. {
  64. Debug.Log(result);
  65. }
  66. }
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. switch (surface)
  74. {
  75.  
  76. case "Concrete":
  77.  
  78. {
  79. Debug.Log(surface + "Stepped on");
  80.  
  81.  
  82. }
  83. break;
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94. }
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement