Compare commits

..

No commits in common. "4eb6e3c01dbb65dfd9e2db0ef57964182131c51d" and "88af3457adafcf39247f083ac305476b7b83a6e3" have entirely different histories.

2 changed files with 56 additions and 59 deletions

View File

@ -119,77 +119,73 @@ public class Bullet : MonoBehaviour
private void OnTriggerEnter2D(Collider2D collision)
{
Role Crole = collision.gameObject.GetComponent<Role>();
if (Crole)
if (NumberOfBulletAttacks > 0)
{
if (Crole.camp != role.camp)
NumberOfBulletAttacks -= 1;
//Debug.Log("进入检测范围");
Role Crole = collision.gameObject.GetComponent<Role>();
if (Crole)
{
if (NumberOfBulletAttacks < 0)
if (Crole.camp != role.camp)
{
return;
}
else
{
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<Huo>().bullet = this;
Crole.FlashRedEffect();
//Debug.Log("创建火焰");
}
if (bulletAttributes == BulletAttributes.Fire) //火
{
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<Huo>().bullet = this;
Crole.FlashRedEffect();
//Debug.Log("创建火焰");
}
}
}
if (bulletAttributes == BulletAttributes.Water) //ˮ
@ -206,8 +202,13 @@ public class Bullet : MonoBehaviour
}
}
}
}
else
{
}
}
private float lastDamageTime = 0f;
private void OnTriggerStay2D(Collider2D collision)

View File

@ -36,10 +36,6 @@ public enum CharacterFlags
land = 1 << 1,
big = 1 << 2,
min = 1 << 3,
FlyBig=fly|big,
FlyMin=fly|min,
LandBig = land | big,
LandMin = land | min,
}
/// <summary>