Files
zeling_v2/Assets/_Game/Scripts/Enemies/AI/BD_SpawnProjectile.cs
Joywayer a1b4e629aa 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.
2026-05-23 19:10:29 +08:00

43 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#if GRAPH_DESIGNER
using UnityEngine;
using Opsive.BehaviorDesigner.Runtime.Tasks;
using Opsive.BehaviorDesigner.Runtime.Tasks.Actions;
using BaseGames.Core;
using BaseGames.Core.Pool;
namespace BaseGames.Enemies.AI
{
/// <summary>
/// BD Action在敌人当前位置生成弹射物。
/// ProjectileKey 为 Addressable 键,通过 GlobalObjectPool 实例化。
/// </summary>
[TaskName("Spawn Projectile")]
[TaskCategory("BaseGames/Enemy/Utility")]
[TaskDescription("在指定位置生成投射物并赋予初速度")]
public class BD_SpawnProjectile : Action
{
[SerializeField] private Vector2 m_Direction = Vector2.right;
[SerializeField] private string m_ProjectileKey = "";
[SerializeField] private float m_Speed = 8f;
public override TaskStatus OnUpdate()
{
if (string.IsNullOrEmpty(m_ProjectileKey)) return TaskStatus.Failure;
var pool = ServiceLocator.GetOrDefault<IObjectPoolService>();
if (pool == null) return TaskStatus.Failure;
var go = pool.Spawn(m_ProjectileKey, transform.position, Quaternion.identity);
if (go != null)
{
var rb = go.GetComponent<Rigidbody2D>();
if (rb != null)
rb.velocity = m_Direction.normalized * m_Speed;
}
return TaskStatus.Success;
}
}
}
#endif