Add audio logs.
加入音频的日志。
This commit is contained in:
parent
6807064bd8
commit
5ad4c1f09d
|
@ -127,3 +127,6 @@ log_room_slot_position_is_empty,房间位置描述为空。,Room location is des
|
||||||
log_room_overlap,房间重叠。,The rooms overlap.,部屋が重なります。
|
log_room_overlap,房间重叠。,The rooms overlap.,部屋が重なります。
|
||||||
log_game_over_event_is_empty,游戏结束事件为空。,End of game event is empty.,ゲームオーバーでイベントは空です。
|
log_game_over_event_is_empty,游戏结束事件为空。,End of game event is empty.,ゲームオーバーでイベントは空です。
|
||||||
log_cannot_resurrect_non_existent_player,不能复活不存在的玩家。,Cannot resurrect non-existent players.,存在しないプレイヤーを復活させることはできません。
|
log_cannot_resurrect_non_existent_player,不能复活不存在的玩家。,Cannot resurrect non-existent players.,存在しないプレイヤーを復活させることはできません。
|
||||||
|
log_no_audio_stream_player,没有音频播放器组件。,No audio player component.,オーディオプレーヤーキットはありません。
|
||||||
|
log_audio_stream_player_is_playing,音频播放器正在播放中。,The audio player is playing.,オーディオプレーヤーが再生中です。
|
||||||
|
log_play_audio,播放音频BUS为{0}Stream为{1}.,BUS is {0} and Stream is {1}.,再生オーディオはBUSが{0}Streamが{1}です。
|
|
|
@ -175,7 +175,7 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool _loadedResource;
|
private bool _loadedResource;
|
||||||
|
|
||||||
public sealed override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
LoadResource();
|
LoadResource();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using ColdMint.scripts.character;
|
using ColdMint.scripts.character;
|
||||||
|
using ColdMint.scripts.debug;
|
||||||
using ColdMint.scripts.pickable;
|
using ColdMint.scripts.pickable;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
|
@ -22,8 +23,11 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
|
||||||
public override void LoadResource()
|
public override void LoadResource()
|
||||||
{
|
{
|
||||||
base.LoadResource();
|
base.LoadResource();
|
||||||
|
if (_audioStreamPlayer2D == null)
|
||||||
|
{
|
||||||
_audioStreamPlayer2D = GetNode<AudioStreamPlayer2D>("Marker2D/AudioStreamPlayer2D");
|
_audioStreamPlayer2D = GetNode<AudioStreamPlayer2D>("Marker2D/AudioStreamPlayer2D");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Use(Node2D? owner, Vector2 targetGlobalPosition)
|
public override bool Use(Node2D? owner, Vector2 targetGlobalPosition)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +101,26 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
|
||||||
characterTemplate.AddForce(enemyGlobalPosition.DirectionTo(characterTemplate.GlobalPosition) * _recoilStrength * Config.CellSize);
|
characterTemplate.AddForce(enemyGlobalPosition.DirectionTo(characterTemplate.GlobalPosition) * _recoilStrength * Config.CellSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_audioStreamPlayer2D?.Play();
|
if (_audioStreamPlayer2D == null)
|
||||||
|
{
|
||||||
|
//No audio player
|
||||||
|
//没有音频播放器
|
||||||
|
LogCat.Log("no_audio_stream_player");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_audioStreamPlayer2D.IsPlaying())
|
||||||
|
{
|
||||||
|
//The audio is playing
|
||||||
|
//音频正在播放中
|
||||||
|
LogCat.Log("audio_stream_player_is_playing");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Play audio
|
||||||
|
//播放音频
|
||||||
|
LogCat.LogWithFormat("play_audio", LogCat.LogLabel.Default, _audioStreamPlayer2D.Bus, _audioStreamPlayer2D.Stream);
|
||||||
|
_audioStreamPlayer2D.Play();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user