Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using FMOD.Studio;
- using UnityEditor.Callbacks;
- using UnityEditor.ShaderGraph.Internal;
- public class FootstepSound : walk
- {
- public FootstepScriptables FootstepScriptablesVariable;
- string surface = "";
- void Start()
- {
- FootstepScriptables.playerWalkingOnConcreteFlat = AudioManager.instance.CreateEventInstance(FModEvents.instance.PlayerWalkingOnConcreteFlat);
- FootstepScriptables.playerWalkingOnWoodFlat = AudioManager.instance.CreateEventInstance(FModEvents.instance.PlayerWalkingOnWoodFlat);
- FootstepScriptables.PlayerWalkingOnCarpetFlat = AudioManager.instance.CreateEventInstance(FModEvents.instance.PlayerWalkingOnCarpetFlat);
- FootstepScriptables.PlayerWalkingOnMetalFlat = AudioManager.instance.CreateEventInstance(FModEvents.instance.PlayerWalkingOnMetalFlat);
- }
- void OnTriggerEnter2D(Collider2D collision2DSurface)
- {
- if (collision2DSurface.gameObject.CompareTag("Concrete"))
- {
- //surface = surface.name;
- Debug.Log(surface);
- }
- else if (collision2DSurface.gameObject.CompareTag("Wood"))
- {
- Debug.Log("Wood");
- }
- }
- void FixedUpdate()
- {
- UpdateSound();
- }
- void UpdateSound()
- {
- if (tristanovement.x != 0 || tristanovement.y != 0)
- {
- PLAYBACK_STATE playbackStateConcreteWalkFlat;
- FootstepScriptables.playerWalkingOnConcreteFlat.getPlaybackState(out playbackStateConcreteWalkFlat);
- if (playbackStateConcreteWalkFlat.Equals(PLAYBACK_STATE.STOPPED))
- {
- FMOD.RESULT result = FootstepScriptables.playerWalkingOnConcreteFlat.start();
- }
- }
- else
- {
- FMOD.RESULT result = FootstepScriptables.playerWalkingOnConcreteFlat.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
- if (result != FMOD.RESULT.OK)
- {
- Debug.Log(result);
- }
- }
- switch (surface)
- {
- case "Concrete":
- {
- Debug.Log(surface + "Stepped on");
- }
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement