敌人冰冻受击变蓝
This commit is contained in:
parent
e53cf6925c
commit
0a6cdaed3f
@ -153,11 +153,17 @@ public class Bullet : MonoBehaviour
|
||||
Collider2D.enabled = false;//¹Ø±ÕÅöײÌå
|
||||
transform.position = collision.transform.position;
|
||||
animator.SetTrigger("Boom");
|
||||
Debug.Log("爆炸动画+++++++++++++++++++++++++++++++++");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (bulletAttributes==BulletAttributes.Fire)
|
||||
if (bulletAttributes == BulletAttributes.Not)//ÎÞÊôÐÔ
|
||||
{
|
||||
Crole.FlashRedEffect();
|
||||
|
||||
}
|
||||
|
||||
if (bulletAttributes==BulletAttributes.Fire)//»ð
|
||||
{
|
||||
|
||||
if (effectPres.Count==1)
|
||||
@ -165,22 +171,23 @@ public class Bullet : MonoBehaviour
|
||||
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)
|
||||
|
||||
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<enemy>().SlowDown(0.2f, 3f);
|
||||
|
||||
Crole.FlashRedEffect(1,3f);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -210,6 +217,7 @@ public class Bullet : MonoBehaviour
|
||||
{
|
||||
|
||||
Crole.bloodLoss(new object[] { Crole, role.DamageCreate(), attackObj.damageTyp, role });
|
||||
Crole.FlashRedEffect();
|
||||
lastDamageTime = Time.time;
|
||||
}
|
||||
|
||||
|
39
Role/Role.cs
39
Role/Role.cs
@ -91,7 +91,7 @@ public class Role : Fun
|
||||
go.GetComponent<SnowHpControl>().direction = HurtDirectin;
|
||||
go.GetComponent<SnowHpControl>().CreateText();
|
||||
go.GetComponent<Text>().text = (temp - hp).ToString("F0"); // 显示伤害值
|
||||
FlashRedEffect(); // 血量减少时的红色闪烁效果
|
||||
//FlashRedEffect(); // 血量减少时的红色闪烁效果
|
||||
|
||||
|
||||
}
|
||||
@ -401,22 +401,37 @@ public class Role : Fun
|
||||
// 如果有其他需要重置的状态,可以在这里添加
|
||||
}
|
||||
|
||||
private void FlashRedEffect()
|
||||
public void FlashRedEffect(int color = 0, float time = 0.2f)//0、1 红、蓝
|
||||
{
|
||||
// 遍历所有的SpriteRenderer组件,让它们变红
|
||||
|
||||
if (spriteRenderer != null)
|
||||
// 如果spriteRenderer存在
|
||||
if (spriteRenderer != null)
|
||||
{
|
||||
// 创建一个Sequence来确保动画按顺序执行
|
||||
Sequence sequence = DOTween.Sequence();
|
||||
|
||||
// 颜色变化
|
||||
if (color == 0)
|
||||
{
|
||||
spriteRenderer.DOColor(UnityEngine.Color.red, 0.2f)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
// 恢复原始颜色
|
||||
spriteRenderer.DOColor(UnityEngine.Color.white, 0.2f);
|
||||
});
|
||||
// 变为红色并恢复白色
|
||||
sequence.Append(spriteRenderer.DOColor(UnityEngine.Color.red, 0.2f))
|
||||
.Append(spriteRenderer.DOColor(UnityEngine.Color.white, time));
|
||||
}
|
||||
|
||||
else if (color == 1)
|
||||
{
|
||||
// 更冷的深蓝色
|
||||
UnityEngine.Color frostBlueWithAlpha = new UnityEngine.Color(0.2f, 0.5f, 1f); ; // 冰冻蓝色
|
||||
|
||||
// 变为蓝色并恢复白色
|
||||
sequence.Append(spriteRenderer.DOColor(frostBlueWithAlpha, 0.2f))
|
||||
.Append(spriteRenderer.DOColor(UnityEngine.Color.white, time));
|
||||
}
|
||||
|
||||
// 开始执行Sequence
|
||||
sequence.Play();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void StopDoTween(float stopTime)
|
||||
{
|
||||
// 暂停当前的动画
|
||||
|
Loading…
Reference in New Issue
Block a user