UnityCommon/Role/RunRangeBullet.cs

87 lines
2.0 KiB
C#
Raw Permalink Normal View History

2025-01-04 18:09:38 +08:00
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 + "<22><><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
int direction = 0;
if (collision.transform.position.x > transform.position.x) //<2F>ӵ<EFBFBD><D3B5>򵽵<EFBFBD><F2B5BDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ұ<EFBFBD>
{
direction = 1;
}
Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent<Role>()), attackObj.damageTyp, role }, direction);
2025-01-04 20:08:40 +08:00
if (attackObj.haveAddDamage)
{
Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent<Role>())*0.3f, attackObj.AdddamageType, role }, direction);
}
2025-01-04 18:09:38 +08:00
Crole.FlashRedEffect();
}
}
}
private void OnTriggerStay2D(Collider2D collision)
{
}
private void OnTriggerExit2D(Collider2D collision)
{
}
}