87 lines
2.0 KiB
C#
87 lines
2.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
public class RunRangeBullet : Bullet
|
|
{
|
|
|
|
|
|
private void Update()
|
|
{
|
|
|
|
transform.RotateAround(attackObj.BulletStartPos.position, Vector3.forward, 20f * Time.deltaTime*bulletData.BulletSpeed);
|
|
|
|
|
|
}
|
|
|
|
private void OnTriggerEnter2D(Collider2D collision)
|
|
{
|
|
Role Crole = collision.gameObject.GetComponent<Role>();
|
|
if (Crole&&Target!= collision.gameObject)
|
|
{
|
|
if (Crole.camp != role.camp)
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var buff in role.storageBuff)
|
|
{
|
|
if (!Crole.PlayerBuff.Contains(buff))
|
|
{
|
|
Crole.PlayerBuff.Add(buff);
|
|
}
|
|
}
|
|
|
|
Crole.ApplyBuffs();
|
|
|
|
// Debug.Log(this.role.gameObject.name + "进行攻击计算");
|
|
int direction = 0;
|
|
if (collision.transform.position.x > transform.position.x) //子弹打到敌人左边,飘字显示到右边
|
|
{
|
|
direction = 1;
|
|
}
|
|
Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent<Role>()), attackObj.damageTyp, role }, direction);
|
|
if (attackObj.haveAddDamage)
|
|
{
|
|
Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent<Role>())*0.3f, attackObj.AdddamageType, role }, direction);
|
|
}
|
|
Crole.FlashRedEffect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
private void OnTriggerStay2D(Collider2D collision)
|
|
{
|
|
|
|
}
|
|
|
|
private void OnTriggerExit2D(Collider2D collision)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|