using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; using Unity.VisualScripting; using UnityEngine; using UnityEngine.UIElements; using System.Linq; public class mhd_Bullet : Bullet { private void Start() { } private void Update() { switch (this.bulletMoveType) { //更具子弹的移动方式来移动 case BulletMoveType.PeerToPeer: if (IsMove) { this.gameObject.transform.Translate(Vector3.up * Time.deltaTime * bulletData.BulletSpeed); timer += Time.deltaTime; if (timer > BulletDeadTimer) { attackObj.bulltes.Remove(this.gameObject); Debug.Log("对象已成功移除。当前列表数量:" + attackObj.bulltes.Count); Destroy(this.gameObject); } } break; case BulletMoveType.PointToDirection: break; case BulletMoveType.Scope: break; } } private void OnTriggerEnter2D(Collider2D collision) { Role Crole = collision.gameObject.GetComponent(); if (Crole) { 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()), attackObj.damageTyp, role }, direction); Crole.FlashRedEffect(); } } } private void OnTriggerStay2D(Collider2D collision) { } private void OnTriggerExit2D(Collider2D collision) { } }