revert(enemy): 收掉死亡层——死亡归物理层,AI 只需一个终态
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1631ed6da4d4c14bb29e845f5065f51
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using BaseGames.AI;
|
||||
using BaseGames.Enemies.Abilities;
|
||||
|
||||
namespace BaseGames.Enemies
|
||||
{
|
||||
/// <summary>单段死亡能力:进入即触发一次,不重播。</summary>
|
||||
[Serializable]
|
||||
public sealed class AbilityDeath : IDeathModule
|
||||
{
|
||||
public const string Death = "Death";
|
||||
|
||||
[Tooltip("死亡演出能力")]
|
||||
[SerializeField] AbilityRef _ability;
|
||||
|
||||
public AbilityDeath() { }
|
||||
public AbilityDeath(AbilityRef ability) { _ability = ability; }
|
||||
|
||||
public string EntryState => Death;
|
||||
|
||||
public void Build(BrainBuilder b)
|
||||
{
|
||||
string id = _ability.Id;
|
||||
if (string.IsNullOrEmpty(id))
|
||||
throw new InvalidOperationException("AbilityDeath:未配置死亡能力。若死亡演出走物理状态机,请改用 TerminalDeath。");
|
||||
AiStateFragments.AbilityOnce(b, Death, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a3f1cc9d7026a840a01ab2dc951006b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using BaseGames.AI;
|
||||
|
||||
namespace BaseGames.Enemies
|
||||
{
|
||||
/// <summary>死亡演出交给物理状态机(EnemyBase.PerformDeath):AI 只需要一个无行为终态。</summary>
|
||||
[Serializable]
|
||||
public sealed class TerminalDeath : IDeathModule
|
||||
{
|
||||
public const string Death = "Death";
|
||||
public string EntryState => Death;
|
||||
public void Build(BrainBuilder b) => AiStateFragments.Terminal(b, Death);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efb16f225a6b3b846b117409a3dfb620
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,38 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using BaseGames.AI;
|
||||
using BaseGames.Enemies.Abilities;
|
||||
|
||||
namespace BaseGames.Enemies
|
||||
{
|
||||
/// <summary>两段死亡:前段(挣扎 / 膨胀)播完接后段(爆体,可带生成物)。</summary>
|
||||
[Serializable]
|
||||
public sealed class TwoStageDeath : IDeathModule
|
||||
{
|
||||
public const string DeathPre = "Death_Pre";
|
||||
public const string Death = "Death";
|
||||
|
||||
[Tooltip("前段演出能力(挣扎 / 膨胀)")]
|
||||
[SerializeField] AbilityRef _preAbility;
|
||||
[Tooltip("后段演出能力(爆体 / 生成物)")]
|
||||
[SerializeField] AbilityRef _ability;
|
||||
|
||||
public TwoStageDeath() { }
|
||||
public TwoStageDeath(AbilityRef preAbility, AbilityRef ability)
|
||||
{ _preAbility = preAbility; _ability = ability; }
|
||||
|
||||
public string EntryState => DeathPre;
|
||||
|
||||
public void Build(BrainBuilder b)
|
||||
{
|
||||
string preId = _preAbility.Id;
|
||||
string id = _ability.Id;
|
||||
if (string.IsNullOrEmpty(preId)) throw new InvalidOperationException("TwoStageDeath:未配置前段能力。");
|
||||
if (string.IsNullOrEmpty(id)) throw new InvalidOperationException("TwoStageDeath:未配置后段能力。");
|
||||
|
||||
AiStateFragments.AbilityOnce(b, DeathPre, preId)
|
||||
.To(Death).When(x => !x.Combat.IsAbilityRunning(preId), "preDone");
|
||||
AiStateFragments.AbilityOnce(b, Death, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ebca92989544c9449248e635c9a6103
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,19 +0,0 @@
|
||||
using BaseGames.AI;
|
||||
|
||||
namespace BaseGames.Enemies
|
||||
{
|
||||
/// <summary>
|
||||
/// 死亡层:单态终结(演出交给物理状态机)/ 单段死亡能力 / 两段演出(可带生成物)。
|
||||
/// 骨架只挂一条 Global → EntryState 的 Died 事件边,链条内容全归本模块。
|
||||
///
|
||||
/// 同 IEngagementModule:骨架只把全局 Died 边指向 EntryState,不在死亡链内部挂边,
|
||||
/// 故单阶段 Build 足够。
|
||||
/// </summary>
|
||||
public interface IDeathModule
|
||||
{
|
||||
void Build(BrainBuilder b);
|
||||
|
||||
/// <summary>骨架全局死亡边指向的态。</summary>
|
||||
string EntryState { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca95968c577c65244bfb6c5a9a908ef4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user