25 lines
642 B
C#
25 lines
642 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Stunning : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private float duration;
|
|
[SerializeField]
|
|
private bool knockback = true;
|
|
[SerializeField]
|
|
private Vector2 stunDir;
|
|
|
|
|
|
private void OnCollisionEnter(Collision other) {
|
|
if (other.gameObject.tag.Equals("Player")){//Collided w/ player, stun him
|
|
PlayerController player = other.gameObject.GetComponent<PlayerController>();
|
|
player.Stun(duration);
|
|
if(knockback){
|
|
player.Knockback(stunDir);
|
|
}
|
|
}
|
|
}
|
|
}
|