冰
This commit is contained in:
parent
1e50006cf9
commit
8fec6273a4
@ -164,9 +164,20 @@ public class Bullet : MonoBehaviour
|
||||
Debug.Log("´´˝¨ťđŃć");
|
||||
}
|
||||
}
|
||||
if (bulletAttributes == BulletAttributes.Water)
|
||||
{
|
||||
if (effectPre != null)
|
||||
{
|
||||
GameObject go = Instantiate(effectPre, 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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
private float lastDamageTime = 0f;
|
||||
|
12
Role/Role.cs
12
Role/Role.cs
@ -47,6 +47,7 @@ public class Role : Fun
|
||||
[Header("自己的画布")]public Canvas _Canvas;
|
||||
[Header("自己的图片")] public SpriteRenderer spriteRenderers; // 存储所有的SpriteRenderer组件
|
||||
[Header("被打的方向")] public int HurtDirectin;
|
||||
|
||||
|
||||
public float Hp
|
||||
{
|
||||
@ -254,6 +255,17 @@ public class Role : Fun
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ½ÇÉ«¼õËÙ
|
||||
/// </summary>
|
||||
public void SlowDown(float num)
|
||||
{
|
||||
Navigation.speedFactor *= num;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单位更新buff
|
||||
/// </summary>
|
||||
|
@ -20,6 +20,7 @@ public class SimplePathfindingDoTween : Fun
|
||||
Vector3 Vector3 = new Vector3();
|
||||
|
||||
public Tween pathTween;
|
||||
public float speedFactor=1;//速度因子
|
||||
|
||||
[Header("旋转的动画")]public GameObject obj;
|
||||
public void MoveToNextWaypoint(GameObject gameObject, float moveSpeed)
|
||||
@ -51,7 +52,16 @@ public class SimplePathfindingDoTween : Fun
|
||||
// 使用DoTween的DOPath来平滑地移动
|
||||
pathTween=gameObject.transform.DOPath(path, timeToReach, PathType.Linear)
|
||||
.SetEase(Ease.Linear)
|
||||
.OnUpdate(() => RotateTowardsTarget()); // 每次更新时调整旋转
|
||||
.OnUpdate(() => {
|
||||
|
||||
|
||||
pathTween.timeScale = speedFactor;
|
||||
|
||||
RotateTowardsTarget(); }
|
||||
|
||||
|
||||
|
||||
); // 每次更新时调整旋转
|
||||
|
||||
}
|
||||
else
|
||||
@ -65,7 +75,20 @@ public class SimplePathfindingDoTween : Fun
|
||||
transform.DOPause();
|
||||
}
|
||||
|
||||
// 控制DoTween的速度,接受一个新的速度因子和一个恢复时间
|
||||
public void ChangeSpeed(float newSpeedFactor, float restoreTime)
|
||||
{
|
||||
// 改变路径动画的速度因子
|
||||
pathTween.timeScale = newSpeedFactor;
|
||||
|
||||
// 设置一个延迟恢复原始速度的功能
|
||||
DOTween.To(() => 0f, x => { }, 0f, restoreTime).OnKill(() =>
|
||||
{
|
||||
Debug.Log("设置减速+++++++++++++++++");
|
||||
// 在延迟结束后恢复原来的速度
|
||||
pathTween.timeScale = 1f; // 恢复原速度
|
||||
});
|
||||
}
|
||||
public void StopPathDoTween(float stopTime)//暂停移动
|
||||
{
|
||||
// 暂停当前的动画
|
||||
|
Loading…
Reference in New Issue
Block a user