UnityCommon/Role/mhd_Bullet.cs

114 lines
2.5 KiB
C#
Raw Permalink Normal View History

2025-01-10 16:22:12 +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 mhd_Bullet : Bullet
{
private void Start()
{
}
private void Update()
{
switch (this.bulletMoveType)
{
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ƶ<EFBFBD>
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("<22><><EFBFBD><EFBFBD><EFBFBD>ѳɹ<D1B3><C9B9>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + 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<Role>();
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 + "<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);
Crole.FlashRedEffect();
}
}
}
private void OnTriggerStay2D(Collider2D collision)
{
}
private void OnTriggerExit2D(Collider2D collision)
{
}
}