diff --git a/Role/Attack.cs b/Role/Attack.cs index 0aa0d34..b356208 100644 --- a/Role/Attack.cs +++ b/Role/Attack.cs @@ -45,6 +45,7 @@ public class Attack : MonoBehaviour [Header("是否造成额外伤害")] public bool haveAddDamage = false; [Header("额外伤害类型")] public DamageType AdddamageType=DamageType.magicDamage; [Header("子弹爆炸范围")] public float BoomRange = 1; + [Header("子弹放大倍数")] public float BulletAddSize = 0; public bool isAttack = true; public bool flag = false; [HideInInspector] public float timer = 0; @@ -188,6 +189,7 @@ public class Attack : MonoBehaviour BulletGamobj.GetComponent().attackObj = this; BulletGamobj.GetComponent().bulletData.BulletSpeed *= (1 + roleBulletSpeedAdd); BulletGamobj.GetComponent().Target = Target; + BulletGamobj.transform.localScale=new Vector3(BulletGamobj.transform.localScale.x*(1+ BulletAddSize), BulletGamobj.transform.localScale.y * (1 + BulletAddSize), BulletGamobj.transform.localScale.z * (1 + BulletAddSize));//子弹放大 BulletGamobj.transform.up = direction; BulletGamobj.transform.position = BulletStartPos.position; bulltes.Add(BulletGamobj); diff --git a/Role/mhd_Bullet.cs b/Role/mhd_Bullet.cs new file mode 100644 index 0000000..78d54cf --- /dev/null +++ b/Role/mhd_Bullet.cs @@ -0,0 +1,113 @@ +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) + { + + } + + + +} diff --git a/Role/mhd_Bullet.cs.meta b/Role/mhd_Bullet.cs.meta new file mode 100644 index 0000000..ef655b1 --- /dev/null +++ b/Role/mhd_Bullet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dd49bd0505ac6954ea756500c434b98c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: