Merge branch 'main' of http://shu.sheziwanglo.cn:3000/shurongsen/UnityCommon
This commit is contained in:
commit
e53cf6925c
@ -85,7 +85,7 @@ public class Bullet : MonoBehaviour
|
||||
[Header("子弹动画")] public Animator animator;
|
||||
[Header("子弹移动参数")] public bool IsMove=true;
|
||||
[Header("子弹碰撞体")] public Collider2D Collider2D;
|
||||
[Header("×Óµ¯ÌØЧԤÖÆÌå")] public GameObject effectPre;
|
||||
[Header("×Óµ¯ÌØЧԤÖÆÌå")] public List<GameObject> effectPres=new List<GameObject>();
|
||||
private float timer = 0;
|
||||
private void Update()
|
||||
{
|
||||
@ -159,20 +159,23 @@ public class Bullet : MonoBehaviour
|
||||
|
||||
if (bulletAttributes==BulletAttributes.Fire)
|
||||
{
|
||||
if (effectPre!=null)
|
||||
{
|
||||
GameObject go = Instantiate(effectPre, collision.transform);
|
||||
|
||||
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;
|
||||
|
||||
|
||||
Debug.Log("创建火焰");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (bulletAttributes == BulletAttributes.Water)
|
||||
{
|
||||
if (effectPre != null)
|
||||
if (effectPres.Count > 1)
|
||||
{
|
||||
GameObject go = Instantiate(effectPre, collision.transform);
|
||||
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);
|
||||
|
||||
@ -182,7 +185,7 @@ public class Bullet : MonoBehaviour
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private float lastDamageTime = 0f;
|
||||
private void OnTriggerStay2D(Collider2D collision)
|
||||
|
@ -55,7 +55,7 @@ public class SimplePathfindingDoTween : Fun
|
||||
.OnUpdate(() => {
|
||||
|
||||
|
||||
pathTween.timeScale = speedFactor;
|
||||
//pathTween.timeScale = speedFactor;
|
||||
|
||||
RotateTowardsTarget(); }
|
||||
|
||||
@ -78,14 +78,15 @@ public class SimplePathfindingDoTween : Fun
|
||||
// 控制DoTween的速度,接受一个新的速度因子和一个恢复时间
|
||||
public void ChangeSpeed(float newSpeedFactor, float restoreTime)
|
||||
{
|
||||
// 改变路径动画的速度因子
|
||||
pathTween.timeScale = newSpeedFactor;
|
||||
// 当前的时间缩放因子
|
||||
float currentSpeedFactor = pathTween.timeScale;
|
||||
|
||||
// 设置一个延迟恢复原始速度的功能
|
||||
DOTween.To(() => 0f, x => { }, 0f, restoreTime).OnKill(() =>
|
||||
{
|
||||
Debug.Log("设置减速+++++++++++++++++");
|
||||
// 在延迟结束后恢复原来的速度
|
||||
// 使用Tween来平滑地调整速度因子
|
||||
DOTween.To(() => currentSpeedFactor, x => pathTween.timeScale = x, newSpeedFactor, restoreTime)
|
||||
.OnKill(() =>
|
||||
{
|
||||
Debug.Log("设置减速+++++++++++++++++");
|
||||
// 在延迟结束后恢复原速度
|
||||
pathTween.timeScale = 1f; // 恢复原速度
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user