Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / item / weapon / shell / ShellCase.cs
  1.  
  2. using Godot;
  3.  
  4. /// <summary>
  5. /// 弹壳类
  6. /// </summary>
  7. [RegisterActivity(ActivityIdPrefix.Shell + "0001", ResourcePath.prefab_weapon_shell_ShellCase_tscn)]
  8. public partial class ShellCase : ActivityObject
  9. {
  10. /// <summary>
  11. /// 动画播放器
  12. /// </summary>
  13. public AnimationPlayer AnimationPlayer { get; private set; }
  14. public override void _Ready()
  15. {
  16. AnimationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
  17. ShadowOffset = new Vector2(0, 1);
  18. }
  19.  
  20. protected override void OnThrowOver()
  21. {
  22. //AwaitDestroy();
  23. AnimationPlayer.Play("flicker");
  24. }
  25.  
  26. private async void AwaitDestroy()
  27. {
  28. //2秒后销毁
  29. await ToSignal(GetTree().CreateTimer(2), "timeout");
  30. Destroy();
  31. }
  32. }