diff --git a/Assets/PlayerController.cs b/Assets/PlayerController.cs new file mode 100644 index 0000000..da3c0c7 --- /dev/null +++ b/Assets/PlayerController.cs @@ -0,0 +1,29 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PlayerController : MonoBehaviour +{ + [SerializeField] + private LayerMask stunLayerMask; + private GrappleHook grappleScript; + [SerializeField] + private float stunDuration; + // Start is called before the first frame update + void Start() + { + grappleScript = GetComponent(); + } + + // Update is called once per frame + void Update() + { + + } + + private void OnCollisionEnter(Collision other) { + if(((1<(); @@ -55,6 +55,9 @@ public class GrappleHook : MonoBehaviour void Update() { + if(isStunned){ + return; + } if(grappled){ DrawRope(Time.deltaTime); @@ -153,6 +156,23 @@ public class GrappleHook : MonoBehaviour } + private void UnStun(){ + isStunned = false; + Debug.Log("unstunned"); + } +#endregion + +#region public methods + +public void Stun(float duration){ + isStunned = true; + EndGrapple(); + Debug.Log("Stunned"); + Invoke("UnStun", duration); +} +#endregion + +#region InputActions public void Grapple(InputAction.CallbackContext context){ if(grappling && grappled)return; if(context.performed){ @@ -194,5 +214,5 @@ public class GrappleHook : MonoBehaviour } } - +#endregion } diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index e72aa34..e19ef7b 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -12,7 +12,7 @@ TagManager: - Water - UI - Grappleable - - + - Stun - - -