法杖,武器切换
This commit is contained in:
@@ -14,7 +14,7 @@ using Random = UnityEngine.Random;
|
||||
|
||||
namespace Cielonos.MainGame
|
||||
{
|
||||
public abstract partial class AttackAreaBase : MonoBehaviour
|
||||
public abstract partial class AttackAreaBase : SerializedMonoBehaviour
|
||||
{
|
||||
private static Dictionary<string, int> areaNameCountDictionary = new Dictionary<string, int>();
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace Cielonos.MainGame
|
||||
public Action updateAction;
|
||||
|
||||
[Title("Submodules")]
|
||||
[HideInEditorMode] public TransformSubmodule transformSm;
|
||||
[HideInEditorMode] public AttackSubmodule attackSm;
|
||||
[HideInEditorMode] public TimeSubmodule timeSm;
|
||||
[HideInEditorMode] public HitSubmodule hitSm;
|
||||
@@ -96,12 +97,19 @@ namespace Cielonos.MainGame
|
||||
}
|
||||
|
||||
this.SetReactionSubmodule<T>();
|
||||
|
||||
BattleManager.AttackAreaSm.Register(this);
|
||||
topParent.GetComponent<VFXObject>().onDespawnAction = () =>
|
||||
{
|
||||
BattleManager.AttackAreaSm.Unregister(this);
|
||||
};
|
||||
|
||||
return this as T;
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
transformSm?.Update();
|
||||
raycastSm?.Update();
|
||||
updateAction?.Invoke();
|
||||
hitSm?.Update();
|
||||
@@ -112,6 +120,16 @@ namespace Cielonos.MainGame
|
||||
|
||||
public partial class AttackAreaBase
|
||||
{
|
||||
#region TransformSubmodule
|
||||
|
||||
public T SetTransformSubmodule<T>(Transform target = null, float delay = 0) where T : AttackAreaBase
|
||||
{
|
||||
transformSm = new TransformSubmodule(this, target, delay);
|
||||
return this as T;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AttackSubmodule
|
||||
public T SetAttackSubmodule<T>(AttackUnit attackUnit, GameObject hitVFX = null) where T : AttackAreaBase
|
||||
{
|
||||
@@ -163,10 +181,41 @@ namespace Cielonos.MainGame
|
||||
|
||||
#region TraceMoveModule
|
||||
|
||||
public T SetTraceMoveModule<T>(CharacterBase target, float moveSpeed, float moveAcceleration,
|
||||
/// <summary>
|
||||
/// 设置自适应追踪移动子模块,根据和目标的距离自动连接和断开追踪
|
||||
/// 断开追踪后,自动选择范围内最近的目标进行追踪
|
||||
/// </summary>
|
||||
public T SetAdaptiveTraceMoveModule<T>(CharacterBase target, float moveSpeed, float moveAcceleration,
|
||||
float angularSpeed, float angularAcceleration, Vector3 initialDirection,
|
||||
bool autoConnect = true, bool autoDisconnect = true, float detectRadius = 10f, bool stopWhenHit = true) where T : AttackAreaBase
|
||||
{
|
||||
moveSm = new TraceMoveSubmodule(this, target, moveSpeed, moveAcceleration, angularSpeed,
|
||||
angularAcceleration, initialDirection, autoConnect, autoDisconnect, detectRadius, stopWhenHit);
|
||||
return this as T;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置不可更改目标的追踪移动子模块
|
||||
/// 永远追踪指定目标,不会断开
|
||||
/// </summary>
|
||||
public T SetUnchangeableTraceMoveModule<T>(CharacterBase target, float moveSpeed, float moveAcceleration,
|
||||
float angularSpeed, float angularAcceleration, Vector3 initialDirection, bool stopWhenHit = true) where T : AttackAreaBase
|
||||
{
|
||||
moveSm = new TraceMoveSubmodule(this, target, moveSpeed, moveAcceleration, angularSpeed, angularAcceleration, initialDirection, stopWhenHit);
|
||||
moveSm = new TraceMoveSubmodule(this, target, moveSpeed, moveAcceleration, angularSpeed,
|
||||
angularAcceleration, initialDirection, false, false, 0, stopWhenHit);
|
||||
return this as T;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置可分离目标的追踪移动子模块
|
||||
/// 一旦目标超出检测范围则断开追踪,断开后不再追踪其他目标
|
||||
/// </summary>
|
||||
public T SeDetachableTraceMoveModule<T>(CharacterBase target, float moveSpeed, float moveAcceleration,
|
||||
float angularSpeed, float angularAcceleration, Vector3 initialDirection,
|
||||
float detectRadius = 10f, bool stopWhenHit = true) where T : AttackAreaBase
|
||||
{
|
||||
moveSm = new TraceMoveSubmodule(this, target, moveSpeed, moveAcceleration, angularSpeed,
|
||||
angularAcceleration, initialDirection, false, true, detectRadius, stopWhenHit);
|
||||
return this as T;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user