Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public enum EnemyStates
- {
- idle,
- walk,
- attack,
- stagger,
- grab
- }
- public class EnemyController : MonoBehaviour
- {
- public EnemyStates currentState;
- public int baseAttack;
- public string Name;
- public float moveSpeed;
- private void Awake()
- {
- }
- public void Knock(Rigidbody2D theRB, float knockTime)
- {
- StartCoroutine(Knockco(theRB, knockTime));
- }
- private IEnumerator Knockco(Rigidbody2D theRB, float knockTime)
- {
- if (theRB != null)
- {
- yield return new WaitForSeconds(knockTime);
- theRB.velocity = Vector2.zero;
- theRB.GetComponent<EnemyController>().currentState = EnemyStates.idle;
- theRB.velocity = Vector2.zero;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement