水鲨鱼修改
This commit is contained in:
parent
2d4dd3e1c9
commit
861ba21b13
@ -40,6 +40,7 @@ public class Attack : MonoBehaviour
|
||||
[Header("攻击范围显示脚本")] public CharacterClick characterClick;
|
||||
[Header("攻击随机角度范围")] public float Angle=30;
|
||||
[Header("子弹分裂个数")] public int splitNum = 2;
|
||||
[Header("分裂子弹伤害")] public float SplitAttack = 10;
|
||||
public bool isAttack = true;
|
||||
public bool flag = false;
|
||||
[HideInInspector] public float timer = 0;
|
||||
|
@ -304,12 +304,13 @@ public class Bullet : MonoBehaviour
|
||||
for (int i = 0; i < attackObj.splitNum; i++)
|
||||
{
|
||||
// 在当前方向上随机生成偏移量
|
||||
Vector3 randomOffset = new Vector3(Random.Range(-0.2f, 0.2f), Random.Range(-0.2f, 0.2f), Random.Range(-0.2f, 0.2f));
|
||||
Vector3 randomOffset = new Vector3(Random.Range(-0.2f, 0.2f), Random.Range(-0.2f, 0.2f));
|
||||
|
||||
// 生成一个小子弹
|
||||
GameObject smallBullet = Instantiate(smallBulletPrefab, transform.position, Quaternion.identity);
|
||||
smallBullet.GetComponent<SmallBullet>().role = role;
|
||||
smallBullet.GetComponent<SmallBullet>().attackObj=attackObj;
|
||||
smallBullet.GetComponent<SmallBullet>().Target = Target;
|
||||
// 为小子弹设置飞行方向(当前方向 + 随机偏移)
|
||||
smallBullet.transform.up = currentDirection+randomOffset;
|
||||
|
||||
|
10
Role/Role.cs
10
Role/Role.cs
@ -115,8 +115,11 @@ public class Role : Fun
|
||||
{
|
||||
go.GetComponent<SnowHpControl>().CreateText();
|
||||
}
|
||||
if (temp - hp>0)
|
||||
{
|
||||
go.GetComponent<Text>().text = (temp - hp).ToString("F0"); // 显示伤害值
|
||||
}
|
||||
|
||||
go.GetComponent<Text>().text = (temp - hp).ToString("F0"); // 显示伤害值
|
||||
}
|
||||
// 判断角色是否死亡
|
||||
if (hp <= 0)
|
||||
@ -306,7 +309,10 @@ public class Role : Fun
|
||||
if (lsanimationHighlight == dieIndex)
|
||||
{
|
||||
SpawnPool.intance.DeadNumber += 1;
|
||||
Destroy(gameObject);
|
||||
|
||||
Destroy(gameObject);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (lsanimationHighlight == hitIndex)
|
||||
|
@ -24,7 +24,7 @@ public class SmallBullet : Bullet
|
||||
{
|
||||
|
||||
|
||||
this.gameObject.transform.Translate(Vector3.up * Time.deltaTime * bulletData.BulletSpeed);
|
||||
this.gameObject.transform.Translate(Vector3.up * Time.deltaTime * bulletData.BulletSpeed*8);
|
||||
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ public class SmallBullet : Bullet
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
Role Crole = collision.gameObject.GetComponent<Role>();
|
||||
if (Crole)
|
||||
if (Crole&&Target!= collision.gameObject)
|
||||
{
|
||||
if (Crole.camp != role.camp)
|
||||
{
|
||||
@ -70,10 +70,12 @@ public class SmallBullet : Bullet
|
||||
{
|
||||
direction = 1;
|
||||
}
|
||||
Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent<Role>()), attackObj.damageTyp, role }, direction);
|
||||
|
||||
Crole.bloodLoss(new object[] { Crole, attackObj.SplitAttack, attackObj.damageTyp, role }, direction);
|
||||
Crole.FlashRedEffect();
|
||||
role.GetComponent<enemy>().HarmNumber += attackObj.SplitAttack;
|
||||
Debug.Log("·ÖÁѹ¥»÷É˺¦"+ attackObj.SplitAttack);
|
||||
|
||||
if (myBulletType != BulletType.Spraying)
|
||||
if (myBulletType != BulletType.Spraying)
|
||||
{
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user