Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Attacking : MonoBehaviour
- {
- public string Attker;
- public bool isAttking, hasAttacked;
- public Animator AttkAnimator;
- public void AttackLeft()
- {
- //Do Attack
- if(!isAttking)
- {
- hasAttacked = true;
- isAttking = true;
- AttkAnimator.Play(Attker + "Attack0Left");
- }
- }
- public void AttackRight()
- {
- //Do Attack
- if (!isAttking)
- {
- hasAttacked = true;
- isAttking = true;
- AttkAnimator.Play(Attker + "Attack0Right");
- }
- }
- public void AttackUp()
- {
- //Do Attack
- if (!isAttking)
- {
- hasAttacked = true;
- isAttking = true;
- AttkAnimator.Play(Attker + "Attack0Up");
- }
- }
- public void AttackDown()
- {
- //Do Attack
- if (!isAttking)
- {
- hasAttacked = true;
- isAttking = true;
- AttkAnimator.Play(Attker + "Attack0Down");
- }
- }
- public void StopAttk()
- {
- isAttking = false;
- hasAttacked = false;
- }
- public void DamageUp()
- {
- RaycastHit2D up = Physics2D.Raycast(transform.position, Vector2.up, 1.3f, 1 << 0);
- if (up && up.transform.tag == "Player" | up.transform.tag == "Enemy")
- {
- up.transform.GetComponent<Health>().TakeDamage(.5f);
- }
- }
- public void DamageDown()
- {
- RaycastHit2D down = Physics2D.Raycast(transform.position, Vector2.down, 1.3f, 1 << 0);
- if (down && down.transform.tag == "Player" | down.transform.tag == "Enemy")
- {
- down.transform.GetComponent<Health>().TakeDamage(.5f);
- }
- }
- public void DamageLeft()
- {
- RaycastHit2D left = Physics2D.Raycast(transform.position, Vector2.left, 1.3f, 1 << 0);
- if (left && left.transform.tag == "Player" | left.transform.tag == "Enemy")
- {
- left.transform.GetComponent<Health>().TakeDamage(.5f);
- }
- }
- public void DamageRight()
- {
- RaycastHit2D right = Physics2D.Raycast(transform.position, Vector2.right, 1.3f, 1 << 0);
- if (right && right.transform.tag == "Player" | right.transform.tag == "Enemy")
- {
- right.transform.GetComponent<Health>().TakeDamage(.5f);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement