32bit_jam_conjure/Assets/Scripts/PlayerController.cs
louishorlaville a2fa251890 Fixes
2022-10-30 22:12:58 -04:00

38 lines
961 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Bytes.Sound;
public class PlayerController : MonoBehaviour
{
private GrappleHook grappleScript;
private CharacterMovement movementScript;
private Rigidbody rb;
[SerializeField] SoundPlayer soundPlayer;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
grappleScript = GetComponent<GrappleHook>();
movementScript = GetComponent<CharacterMovement>();
soundPlayer = GetComponent<SoundPlayer>();
}
// Update is called once per frame
void Update()
{
}
public void Stun(float duration){
soundPlayer.PlaySound("PlayerHurt");
grappleScript.Stun(duration);
movementScript.Stun(duration);
}
public void Knockback(Vector2 dir){
soundPlayer.PlaySound("PlayerKnockback");
rb.AddForce(dir);
}
}