增加音效接口

This commit is contained in:
2024-10-27 19:08:26 +08:00
parent 872e4b6938
commit c818382408
4 changed files with 25 additions and 15 deletions

View File

@@ -74,7 +74,7 @@ Material:
- _StencilWriteMask: 255
- _active_border: 0
- _border: 0
- _progress: 1
- _progress: 0
- _timeValue: 0
m_Colors:
- _Color: {r: 0, g: 0, b: 0, a: 1}

View File

@@ -1,4 +1,5 @@
using System;
using Framework.Audio;
using Framework.Timer;
using Framework.Utils.Extend;
using Pathfinding;
@@ -19,20 +20,20 @@ namespace Game.Component
public bool HasActive = true;
}
[SerializeField] protected FSMController _fsmController;
[SerializeField] protected AILerp _aiLerp;
public EnemyAnimState AnimState;
[Header ("最大活动区域")] public Vector2 ActiveArea = new Vector2 (10 , 5);
[Header ("随机巡逻区域")] public Vector2 WalkArea = new Vector2 (5 , 5);
[Header ("攻击检测半径")] public float TriggerDistance = -1f;
[Header ("追逐检测半径")] public float FollowDistance = -1f;
[Header ("攻击最小持续时间")] public float AttackStateDuration = 5f; //攻击状态最小持续时间
[Header ("仇恨丢失冷却时间")] public float AttackCDDuration = 2f;
[Header ("单位移动速度")] public float MaxMoveSpeed = 3;
[Header ("常规移动速度系数"), Range (0, 1)] public float WalkSpeedOffset = 1;
[Header ("攻击移动速度系数"), Range (0, 1)] public float AttackSpeedOffset = 1;
[Header ("速度变化系数&插值t")] public float SpeedChangeT = 0.5f;
[SerializeField] protected FSMController _fsmController;
[SerializeField] protected AILerp _aiLerp;
public EnemyAnimState AnimState;
[Header ("攻击触发音效")] public string AttackTriggerAudioSound = "";
[Header ("最大活动区域")] public Vector2 ActiveArea = new Vector2 (10 , 5);
[Header ("随机巡逻区域")] public Vector2 WalkArea = new Vector2 (5 , 5);
[Header ("攻击检测半径")] public float TriggerDistance = -1f;
[Header ("追逐检测半径")] public float FollowDistance = -1f;
[Header ("攻击最小持续时间")] public float AttackStateDuration = 5f; //攻击状态最小持续时间
[Header ("仇恨丢失冷却时间")] public float AttackCDDuration = 2f;
[Header ("单位移动速度")] public float MaxMoveSpeed = 3;
[Header ("常规移动速度系数"), Range (0, 1)] public float WalkSpeedOffset = 1;
[Header ("攻击移动速度系数"), Range (0, 1)] public float AttackSpeedOffset = 1;
[Header ("速度变化系数&插值t")] public float SpeedChangeT = 0.5f;
private float _expSpeedOffset; //额外速度系数
private TimeHandler _expTimeHandler; //额外速度计时器
@@ -198,7 +199,12 @@ namespace Game.Component
public void UpdateSpeedState (bool hasAtk , bool anim = true)
{
if (this._hasAtkState == false && hasAtk)
{
AudioManager.Instance.PlaySound (this.AttackTriggerAudioSound);
}
this._hasAtkState = hasAtk;
var targetSpeedOffset = this._hasAtkState ? this.AttackSpeedOffset : this.WalkSpeedOffset;
if (anim)
{

View File

@@ -1,4 +1,5 @@
using System;
using Framework.Audio;
using Framework.Timer;
using Game.EventDefine;
using UniFramework.Event;
@@ -74,6 +75,7 @@ namespace Game.Component
this.ScenePart.InitPart ();
// this.Pathfinder.data.SetData (this.ScenePart.mapCacheData.bytes);
// this.Pathfinder.FlushGraphUpdates ();
AudioManager.Instance.PlayBGM (this.ScenePart.BGM , 1 , 0.65f);
CameraManager.Instance.SetBoxCollider (this.ScenePart.cameraCollider);
}

View File

@@ -14,6 +14,8 @@ namespace Game.Component
public int completeConditionNumber = 10;
public float playerBaseSpeed = 4f;
[Header("关卡背景音乐")]public string BGM = "";
[FormerlySerializedAs ("completeProp")] public SuccessProp successProp;
[LabelText ("当前完成数:")] private int _currentConditionNumber = 0;