diff --git a/Role/Bullet.cs b/Role/Bullet.cs index 374dff9..c66e281 100644 --- a/Role/Bullet.cs +++ b/Role/Bullet.cs @@ -11,7 +11,6 @@ public enum BulletType Bullet, Lightning, Spraying //原地喷射 - } public enum BulletAttributes { @@ -130,81 +129,88 @@ public class Bullet : MonoBehaviour } else { + if (this.myBulletType== BulletType.Spraying) + { + NumberOfBulletAttacks += 1; + } + NumberOfBulletAttacks -= 1; - } - foreach (var buff in role.storageBuff) - { - if (!Crole.PlayerBuff.Contains(buff)) + foreach (var buff in role.storageBuff) { - Crole.PlayerBuff.Add(buff); + if (!Crole.PlayerBuff.Contains(buff)) + { + Crole.PlayerBuff.Add(buff); + } } - } - Crole.ApplyBuffs(); + 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(), attackObj.damageTyp, role }, direction); - attackObj.bulltes.Remove(this.gameObject); - - if (myBulletType != BulletType.Spraying) - { - - - if (animator == null) + Debug.Log(this.role.gameObject.name + "进行攻击计算"); + int direction = 0; + if (collision.transform.position.x > transform.position.x) //子弹打到敌人左边,飘字显示到右边 { - attackObj.bulltes.Remove(this.gameObject); - Destroy(this.gameObject); + direction = 1; } - else - { - IsMove = false; //停止移动 - Collider2D.enabled = false; //关闭碰撞体 - transform.position = collision.transform.position; - animator.SetTrigger("Boom"); + Crole.bloodLoss(new object[] { Crole, role.DamageCreate(), attackObj.damageTyp, role }, direction); + attackObj.bulltes.Remove(this.gameObject); + if (myBulletType != BulletType.Spraying) + { + + + if (animator == null) + { + attackObj.bulltes.Remove(this.gameObject); + Destroy(this.gameObject); + } + else + { + IsMove = false; //停止移动 + Collider2D.enabled = false; //关闭碰撞体 + transform.position = collision.transform.position; + animator.SetTrigger("Boom"); + + } } - } - if (bulletAttributes == BulletAttributes.Not) //无属性 - { - Crole.FlashRedEffect(); - - } - - if (bulletAttributes == BulletAttributes.Fire) //火 - { - - if (effectPres.Count == 1) + if (bulletAttributes == BulletAttributes.Not) //无属性 { - GameObject go = Instantiate(effectPres[0], collision.transform); - go.transform.position = new Vector2(collision.transform.position.x, - collision.transform.position.y + 0.2f); - go.GetComponent().bullet = this; Crole.FlashRedEffect(); - //Debug.Log("创建火焰"); + } - } - - if (bulletAttributes == BulletAttributes.Water) //水 - { - if (effectPres.Count > 1) + if (bulletAttributes == BulletAttributes.Fire) //火 { - GameObject go = Instantiate(effectPres[Random.Range(0, effectPres.Count - 1)], - collision.transform); - go.transform.position = new Vector2(collision.transform.position.x, - collision.transform.position.y - 0.2f); - collision.transform.GetComponent().SlowDown(0.2f, 3f); - Crole.FlashRedEffect(1, 3f); + + if (effectPres.Count == 1) + { + GameObject go = Instantiate(effectPres[0], collision.transform); + go.transform.position = new Vector2(collision.transform.position.x, + collision.transform.position.y + 0.2f); + go.GetComponent().bullet = this; + Crole.FlashRedEffect(); + //Debug.Log("创建火焰"); + } } + if (bulletAttributes == BulletAttributes.Water) //水 + { + if (effectPres.Count > 1) + { + GameObject go = Instantiate(effectPres[Random.Range(0, effectPres.Count - 1)], + collision.transform); + go.transform.position = new Vector2(collision.transform.position.x, + collision.transform.position.y - 0.2f); + collision.transform.GetComponent().SlowDown(0.2f, 3f); + Crole.FlashRedEffect(1, 3f); + + } + + } + + } } }