feat: Implement Room Streaming System
- Add RoomStreamingManager to manage room loading and unloading based on player proximity. - Create StreamingBudgetConfigSO for memory and performance budgeting of the streaming system. - Introduce TransitionDirector to handle seamless and atmospheric fade transitions between rooms. - Develop WorldGraph to represent room connectivity and facilitate neighbor queries and distance calculations. - Implement RoomNode and RoomEdge classes to structure room data and connections.
This commit is contained in:
44
Assets/_Game/Scripts/Enemies/AI/BD_WalkRandom.cs
Normal file
44
Assets/_Game/Scripts/Enemies/AI/BD_WalkRandom.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
#if GRAPH_DESIGNER
|
||||
using UnityEngine;
|
||||
using Opsive.BehaviorDesigner.Runtime.Tasks;
|
||||
using Opsive.BehaviorDesigner.Runtime.Tasks.Actions;
|
||||
using BaseGames.Enemies;
|
||||
|
||||
namespace BaseGames.Enemies.AI
|
||||
{
|
||||
/// <summary>
|
||||
/// 动作:随机游走(调用 NavAgent.SetRandomDestination)。
|
||||
/// 到达目的地后立即选下一个随机点,持续 Running。
|
||||
/// 常用于巡逻 fallback 或无路点的小怪。
|
||||
/// </summary>
|
||||
[TaskName("Walk Random")]
|
||||
[TaskCategory("BaseGames/Enemy/Movement")]
|
||||
[TaskDescription("随机游走:持续选取随机目的地导航(常用于待机巡逻兜底)")]
|
||||
public sealed class BD_WalkRandom : Action
|
||||
{
|
||||
[Tooltip("尝试选取随机点的次数")]
|
||||
[SerializeField] private int m_RetryCount = 5;
|
||||
|
||||
private EnemyBase _enemy;
|
||||
|
||||
public override void OnAwake() => _enemy = gameObject.GetComponent<EnemyBase>();
|
||||
|
||||
public override void OnStart() => TryWalk();
|
||||
|
||||
public override TaskStatus OnUpdate()
|
||||
{
|
||||
if (_enemy == null) return TaskStatus.Failure;
|
||||
if (_enemy.Nav.IsAtDestination()) TryWalk();
|
||||
return TaskStatus.Running;
|
||||
}
|
||||
|
||||
public override void OnEnd() => _enemy?.StopMovement();
|
||||
|
||||
private void TryWalk()
|
||||
{
|
||||
for (int i = 0; i < m_RetryCount; i++)
|
||||
if (_enemy.Nav.WalkToRandom()) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user