This commit is contained in:
GL 2024-12-18 14:16:52 +08:00
parent c1aef9f6a9
commit f3cad5d509

View File

@ -14,7 +14,7 @@ public class Attack : MonoBehaviour
[Header("攻击范围")] public float attackScope;
[Header("攻击类型")] public DamageType damageTyp = DamageType.noAttributeDamage;
[Header("攻击持续时间")] public float attackCooldown = 1f; // 攻击冷却时间
[Header("攻击CD时间")] public float attackCooldown = 1f; // 攻击冷却时间
private float lastAttackTime = 0f; // 上次攻击的时间
[HideInInspector]
@ -66,7 +66,7 @@ public class Attack : MonoBehaviour
{
if (bulletPrefab.GetComponent<Bullet>().myBulletType != BulletType.Spraying)
{
direction = (targetRole.transform.position - transform.position).normalized;
direction = (targetRole.transform.position - BulletStartPos.position).normalized;
}
animator.SetInteger("State", 1);
lastAttackTime = Time.time; // 更新上次攻击时间
@ -164,7 +164,7 @@ public class Attack : MonoBehaviour
BulletGamobj.GetComponent<Bullet>().role = role;
BulletGamobj.GetComponent<Bullet>().attackObj = this;
BulletGamobj.transform.up = direction;
BulletGamobj.transform.position = transform.position;
BulletGamobj.transform.position = BulletStartPos.position;
bulltes.Add(BulletGamobj);
}