70 lines
1.5 KiB
C#
70 lines
1.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CombaSystem : MonoBehaviour
|
|
{
|
|
public Animator _animator;
|
|
public AudioSource _audio;
|
|
public AudioClip _summerClip;
|
|
|
|
[Header("近战攻击")]
|
|
[SerializeField] protected Vector2 attackSize = new Vector2();
|
|
[SerializeField] protected Vector2 AttackAreaPos;
|
|
[Header("判定偏移")]
|
|
[SerializeField] protected float offsetX = 1f;
|
|
[SerializeField] protected float offsetY = 1f;
|
|
|
|
[SerializeField,Header("检测层级")] protected List<LayerMask> layerMasks;
|
|
|
|
|
|
public float maxHp = 1800;
|
|
public float currentHp;
|
|
[Header("攻击")]
|
|
public float attack = 50;
|
|
|
|
public Action<float> OnHit;
|
|
|
|
protected bool isDie = false;
|
|
protected virtual void Awake()
|
|
{
|
|
currentHp = maxHp;
|
|
}
|
|
public virtual void MelleeAttackAnimEvent()
|
|
{
|
|
Debug.Log("ATTACK");
|
|
|
|
AttackAreaPos = transform.position;
|
|
|
|
AttackAreaPos.x += offsetX;
|
|
AttackAreaPos.y += offsetY;
|
|
|
|
offsetX = this.transform.parent.localScale.x < 0 ? Mathf.Abs(offsetX) : -Mathf.Abs(offsetX);
|
|
}
|
|
|
|
protected void OnDrawGizmos()
|
|
{
|
|
Gizmos.color = Color.red;
|
|
Gizmos.DrawWireCube(AttackAreaPos, attackSize);
|
|
}
|
|
|
|
public bool GetIsDie()
|
|
{
|
|
return isDie;
|
|
}
|
|
|
|
#region 受伤
|
|
//收到攻击
|
|
public virtual void TakeDamage(string hitName, float attack)
|
|
{
|
|
}
|
|
public virtual void TakeDamage(float attack)
|
|
{
|
|
}
|
|
public virtual void TakeDamage()
|
|
{
|
|
}
|
|
#endregion
|
|
}
|