jj
This commit is contained in:
parent
5632ff401d
commit
151503e59d
@ -42,7 +42,8 @@ public class Attack : MonoBehaviour
|
|||||||
[Header("子弹分裂个数")] public int splitNum = 2;
|
[Header("子弹分裂个数")] public int splitNum = 2;
|
||||||
[Header("分裂子弹伤害")] public float SplitAttack = 10;
|
[Header("分裂子弹伤害")] public float SplitAttack = 10;
|
||||||
[Header("子弹围绕范围")] public float RunRange = 3f;
|
[Header("子弹围绕范围")] public float RunRange = 3f;
|
||||||
|
[Header("是否造成额外伤害")] public bool haveAddDamage = false;
|
||||||
|
[Header("额外伤害类型")] public DamageType AdddamageType=DamageType.magicDamage;
|
||||||
public bool isAttack = true;
|
public bool isAttack = true;
|
||||||
public bool flag = false;
|
public bool flag = false;
|
||||||
[HideInInspector] public float timer = 0;
|
[HideInInspector] public float timer = 0;
|
||||||
@ -446,6 +447,8 @@ public class Attack : MonoBehaviour
|
|||||||
|
|
||||||
|
|
||||||
private int lastBulletNumber = 0; // 记录上一次的 BulletNumber
|
private int lastBulletNumber = 0; // 记录上一次的 BulletNumber
|
||||||
|
private float lastbulletLengthAdd = 0; // 记录上一次的 BulletNumber
|
||||||
|
public float bulletLengthAdd = 0f; // 子弹的长度属性
|
||||||
|
|
||||||
public void RunRangeattack() // 生成在周围
|
public void RunRangeattack() // 生成在周围
|
||||||
{
|
{
|
||||||
@ -456,10 +459,10 @@ public class Attack : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 只有在 BulletNumber 变化时,才重新生成子弹
|
// 只有在 BulletNumber 变化时,才重新生成子弹
|
||||||
if (BulletNumber != lastBulletNumber)
|
if (BulletNumber != lastBulletNumber||lastbulletLengthAdd!=bulletLengthAdd) // 检查 BulletNumber 和 bulletLength 是否变化
|
||||||
{
|
{
|
||||||
// 销毁现有的所有子弹
|
// 销毁现有的所有子弹
|
||||||
if (bulltes.Count>0)
|
if (bulltes.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (var bullet in bulltes)
|
foreach (var bullet in bulltes)
|
||||||
{
|
{
|
||||||
@ -467,7 +470,6 @@ public class Attack : MonoBehaviour
|
|||||||
}
|
}
|
||||||
bulltes.Clear(); // 清空子弹列表
|
bulltes.Clear(); // 清空子弹列表
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 计算子弹发射的圆周角度间隔
|
// 计算子弹发射的圆周角度间隔
|
||||||
float angleStep = 360f / BulletNumber; // 计算每个子弹之间的角度间隔
|
float angleStep = 360f / BulletNumber; // 计算每个子弹之间的角度间隔
|
||||||
@ -504,14 +506,24 @@ public class Attack : MonoBehaviour
|
|||||||
// 设置子弹的朝向和位置
|
// 设置子弹的朝向和位置
|
||||||
BulletGamobj.transform.up = scatterDirection; // 让子弹的"up"方向指向计算出的角度
|
BulletGamobj.transform.up = scatterDirection; // 让子弹的"up"方向指向计算出的角度
|
||||||
BulletGamobj.transform.position = position; // 更新子弹的位置
|
BulletGamobj.transform.position = position; // 更新子弹的位置
|
||||||
|
|
||||||
|
if (lastbulletLengthAdd != bulletLengthAdd)
|
||||||
|
{
|
||||||
|
// 根据 bulletLength 设置子弹的长度
|
||||||
|
BulletGamobj.transform.localScale = new Vector3(BulletGamobj.transform.localScale.x + bulletLengthAdd, BulletGamobj.transform.localScale.y, BulletGamobj.transform.localScale.z);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新记录的 BulletNumber
|
|
||||||
|
|
||||||
|
|
||||||
|
// 更新记录的 BulletNumber 和 bulletLength
|
||||||
lastBulletNumber = BulletNumber;
|
lastBulletNumber = BulletNumber;
|
||||||
|
lastbulletLengthAdd = bulletLengthAdd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class Fun : Base
|
|||||||
/// 扣血 传入参数 目标,伤害值,攻击类型,使用者,子弹射来的方向(0是右边,1是左边)
|
/// 扣血 传入参数 目标,伤害值,攻击类型,使用者,子弹射来的方向(0是右边,1是左边)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="objects"></param>
|
/// <param name="objects"></param>
|
||||||
public void bloodLoss(object[] objects,int direction=1)//目标,伤害值,攻击类型,使用者,子弹射来的方向
|
public void bloodLoss(object[] objects,int direction=1)//目标,伤害值,攻击类型,使用者,子弹射来的方向
|
||||||
{
|
{
|
||||||
Role targetAudience = (Role)objects[0];
|
Role targetAudience = (Role)objects[0];
|
||||||
float harm = (float)objects[1];
|
float harm = (float)objects[1];
|
||||||
@ -70,6 +70,8 @@ public class Fun : Base
|
|||||||
break;
|
break;
|
||||||
case DamageType.magicDamage://魔法伤害
|
case DamageType.magicDamage://魔法伤害
|
||||||
finalDamage -= targetAudience.magicArmor;
|
finalDamage -= targetAudience.magicArmor;
|
||||||
|
targetAudience.isMoFa = true;
|
||||||
|
Debug.Log("魔法伤害");
|
||||||
break;
|
break;
|
||||||
case DamageType.noAttributeDamage://无属性伤害
|
case DamageType.noAttributeDamage://无属性伤害
|
||||||
finalDamage -= 0;
|
finalDamage -= 0;
|
||||||
|
15
Role/Role.cs
15
Role/Role.cs
@ -71,7 +71,7 @@ public class Role : Fun
|
|||||||
public float CritRate;//暴击率
|
public float CritRate;//暴击率
|
||||||
public float CriticalHitRateBonus;//暴击加成
|
public float CriticalHitRateBonus;//暴击加成
|
||||||
[Header("击杀数量")] public int killNum;
|
[Header("击杀数量")] public int killNum;
|
||||||
|
[Header("是不是魔法伤害")] public bool isMoFa=false;
|
||||||
public float Hp
|
public float Hp
|
||||||
{
|
{
|
||||||
get => hp;
|
get => hp;
|
||||||
@ -115,9 +115,20 @@ public class Role : Fun
|
|||||||
{
|
{
|
||||||
go.GetComponent<SnowHpControl>().CreateText();
|
go.GetComponent<SnowHpControl>().CreateText();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (temp - hp>0)
|
if (temp - hp>0)
|
||||||
{
|
{
|
||||||
go.GetComponent<Text>().text = (temp - hp).ToString("F0"); // 显示伤害值
|
if (isMoFa)
|
||||||
|
{
|
||||||
|
|
||||||
|
go.GetComponent<Text>().text = "<color=blue>" + (temp - hp).ToString("F0") + "</color>"; // 显示伤害值
|
||||||
|
isMoFa = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
go.GetComponent<Text>().text = (temp - hp).ToString("F0"); // 显示伤害值
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,10 @@ public class RunRangeBullet : Bullet
|
|||||||
direction = 1;
|
direction = 1;
|
||||||
}
|
}
|
||||||
Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent<Role>()), attackObj.damageTyp, role }, direction);
|
Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent<Role>()), attackObj.damageTyp, role }, direction);
|
||||||
|
if (attackObj.haveAddDamage)
|
||||||
|
{
|
||||||
|
Crole.bloodLoss(new object[] { Crole, role.DamageCreate(Crole.GetComponent<Role>())*0.3f, attackObj.AdddamageType, role }, direction);
|
||||||
|
}
|
||||||
Crole.FlashRedEffect();
|
Crole.FlashRedEffect();
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user