Browse Source

SFX added

develop
MrJDunn 3 years ago
parent
commit
42cc22dc88
3 changed files with 38 additions and 2 deletions
  1. BIN
      Assets/Scenes/MainGameplayScene.unity
  2. +14
    -0
      Assets/Scripts/Behaviours/YeetController.cs
  3. +22
    -0
      Assets/World Assets/Prefabs/Player.prefab

BIN
Assets/Scenes/MainGameplayScene.unity (Stored with Git LFS) View File

size 721162

+ 14
- 0
Assets/Scripts/Behaviours/YeetController.cs View File

@ -9,6 +9,9 @@ public class YeetController : InputBehaviour
public GameObject handCarryingPosition; public GameObject handCarryingPosition;
public GameObject parent { get; set; } public GameObject parent { get; set; }
public AudioClip[] yeetClips;
public AudioClip[] childClips;
public float yeetVelocity = 5f; public float yeetVelocity = 5f;
public float yeetDuration = 2f; public float yeetDuration = 2f;
public float windupSpeed = 0.01f; public float windupSpeed = 0.01f;
@ -30,16 +33,21 @@ public class YeetController : InputBehaviour
private float m_velocityWindup; private float m_velocityWindup;
private LineRenderer m_lineRenderer; private LineRenderer m_lineRenderer;
private AudioSource m_audioSource;
private Vector3 preyeetPosition; private Vector3 preyeetPosition;
private void Awake() private void Awake()
{ {
m_body = this.gameObject; m_body = this.gameObject;
m_audioSource = gameObject.AddComponent<AudioSource>();
m_audioSource.spatialBlend = 0f;
} }
public void Hold(GameObject child) public void Hold(GameObject child)
{ {
m_audioSource.clip = childClips[Random.Range(0,childClips.Length)];
_child = child; _child = child;
_child.transform.parent = parent.transform; _child.transform.parent = parent.transform;
_child.GetComponent<YeetHandle>().held = true; _child.GetComponent<YeetHandle>().held = true;
@ -49,6 +57,8 @@ public class YeetController : InputBehaviour
m_YeetAnimator.SetBool("Carry", true); m_YeetAnimator.SetBool("Carry", true);
m_YeetAnimator.SetBool("Yeet", true); m_YeetAnimator.SetBool("Yeet", true);
m_audioSource.Play();
} }
public void Preyeet() public void Preyeet()
@ -58,10 +68,13 @@ public class YeetController : InputBehaviour
m_lineRenderer.material = trajectoryLineMaterial; m_lineRenderer.material = trajectoryLineMaterial;
yeetState = YeetState.Preyeet; yeetState = YeetState.Preyeet;
} }
public void Yeet() public void Yeet()
{ {
m_audioSource.clip = yeetClips[Random.Range(0,yeetClips.Length)];
m_YeetAnimator.SetBool("Yeet", false); m_YeetAnimator.SetBool("Yeet", false);
m_YeetAnimator.SetBool("Carry", false); m_YeetAnimator.SetBool("Carry", false);
@ -75,6 +88,7 @@ public class YeetController : InputBehaviour
m_velocityWindup = 0; m_velocityWindup = 0;
Destroy(m_lineRenderer); Destroy(m_lineRenderer);
m_audioSource.Play();
} }
void Start() void Start()

+ 22
- 0
Assets/World Assets/Prefabs/Player.prefab View File

@ -126,6 +126,28 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
handCarryingPosition: {fileID: 6686278636936064271} handCarryingPosition: {fileID: 6686278636936064271}
yeetClips:
- {fileID: 8300000, guid: 2d26ecf00011bdb4bbe6e60dba9d889e, type: 3}
- {fileID: 8300000, guid: 3433a5c61eb4b504fa17f8aafefccb94, type: 3}
- {fileID: 8300000, guid: 1ae9673877f8d8b42bd5f21f6719eade, type: 3}
- {fileID: 8300000, guid: 328e04d7b7279924d9651c740b96fc94, type: 3}
- {fileID: 8300000, guid: 5496a947a8ca0374da527b80639444b5, type: 3}
- {fileID: 8300000, guid: d99a663d8274f87468e11d0a31571da0, type: 3}
- {fileID: 8300000, guid: eadecf3df4215304babc9fa1e2753c61, type: 3}
- {fileID: 8300000, guid: e7fc48b2f4dcd424fbc89c8ccd55f954, type: 3}
childClips:
- {fileID: 8300000, guid: ee4f744b7998cfa4681a2114cccbbffa, type: 3}
- {fileID: 8300000, guid: 92840820a14d5c04f929159545a89927, type: 3}
- {fileID: 8300000, guid: 30293052bb2f04f40885097b0185a987, type: 3}
- {fileID: 8300000, guid: 69fe9d828a185d94b951f8110d4e3630, type: 3}
- {fileID: 8300000, guid: 552eb1cef1848d847801e9ebc24a8108, type: 3}
- {fileID: 8300000, guid: a8bd8526a0b1a974c97b57eb97361b49, type: 3}
- {fileID: 8300000, guid: 6ea625b03c5658149a9f6baaf740a104, type: 3}
- {fileID: 8300000, guid: 77f924f591d4bfd43b31e12697b9d50b, type: 3}
- {fileID: 8300000, guid: 4b6b02a34565f174aa0160dace4a71ae, type: 3}
- {fileID: 8300000, guid: b59522269b9ea0e40926001d6ed57bd0, type: 3}
- {fileID: 8300000, guid: e94b59152076fa3438110c323273dd1b, type: 3}
- {fileID: 8300000, guid: 1c23e0594d4849e48bbdd0f8825a87d4, type: 3}
yeetVelocity: 20 yeetVelocity: 20
yeetDuration: 2 yeetDuration: 2
windupSpeed: 0.05 windupSpeed: 0.05

Loading…
Cancel
Save