「MissionBehaviour」修訂間的差異
(→Agent 回调) |
(→Agent 回调) |
||
(未顯示同一使用者於中間所作的 3 次修訂) | |||
行 35: | 行 35: | ||
== <big>Agent 回调</big> == | == <big>Agent 回调</big> == | ||
+ | <big> | ||
* '''OnAgentCreated(Agent)''' - 在引擎端创建 Agent 后调用,在 OnAgentBuild 之前调用。推荐使用此回调给 Agent 增加组件。 | * '''OnAgentCreated(Agent)''' - 在引擎端创建 Agent 后调用,在 OnAgentBuild 之前调用。推荐使用此回调给 Agent 增加组件。 | ||
** '''Agent''' - 已创建的 agent. | ** '''Agent''' - 已创建的 agent. | ||
行 51: | 行 52: | ||
** '''Mission.MissileCollisionReaction''' - 已计算的反馈。 | ** '''Mission.MissileCollisionReaction''' - 已计算的反馈。 | ||
** '''Agent''' - 攻击者 agent,可以为空(null)。 | ** '''Agent''' - 攻击者 agent,可以为空(null)。 | ||
− | ** '''Agent''' - 防御者 agent,可以为空(null | + | ** '''Agent''' - 防御者 agent,可以为空(null) 。 |
** '''sbyte''' - 投掷关联的骨架索引。 | ** '''sbyte''' - 投掷关联的骨架索引。 | ||
− | OnMissileHit(Agent, Agent, bool) - | + | * '''OnMissileHit(Agent, Agent, bool)''' - 当投掷击中什么东西后会调用。 |
− | Agent - | + | ** '''Agent''' - 攻击者 agent ,可以为空(null)。 |
− | Agent - | + | ** '''Agent''' - 防御者 agent ,可以为空(null)。 |
− | bool - True | + | ** '''bool''' - 如果攻击取消则为 True 。目前当友伤未启用时出现友伤会取消。 |
− | OnRegisterBlow(Agent, Agent, GameEntity, Blow, AttackCollisionData) - | + | * '''OnRegisterBlow(Agent, Agent, GameEntity, Blow, AttackCollisionData)''' - 在所有命中计算完成后调用。 |
− | Agent - | + | ** '''Agent''' - 攻击者 agent. |
− | Agent - | + | ** '''Agent''' - 防御者 agent. 可以为空(null)。 |
− | GameEntity - | + | ** '''GameEntity''' - 被攻击的实体,可以为空(null)。 |
− | Blow - | + | ** '''Blow''' - 关于打击的信息。 |
− | AttackCollisionData - | + | ** '''AttackCollisionData''' - 关于攻击的信息,也有计算结果。 |
− | OnAgentHit(Agent, Agent, int, int, int) - | + | * '''OnAgentHit(Agent, Agent, int, int, int)''' - agent 被击打时调用。 |
− | Agent - Agent | + | ** '''Agent''' - 被击打的 Agent 。 |
− | Agent - | + | ** '''Agent''' - 攻击者 agent ,可以为空(null)。 |
− | int - | + | ** '''int''' - 计算的伤害。 |
− | int - | + | ** '''int''' - 武器种类索引(index)。注意,这是远程武器投掷的种类的索引,而不是用来发射远程武器的武器的索引。 |
− | int - | + | ** '''int''' - 使用的武器的索引。 |
− | OnScoreHit(Agent, Agent, int, bool, float, float, float, AgentAttackType, float, int) - | + | * '''OnScoreHit(Agent, Agent, int, bool, float, float, float, AgentAttackType, float, int)''' - agent 被击打时调用,在 '''OnAgentHit''' 之后。 |
− | Agent - | + | ** '''Agent''' - 被击打的 agent。 |
− | Agent - | + | ** '''Agent''' - 攻击者 agent ,可以为空(null)。 |
− | int - | + | ** '''int''' - 武器种类索引(index)。注意,这是远程武器投掷的种类的索引,而不是用来发射远程武器的武器的索引。 |
− | bool - | + | ** '''bool''' - 如果击打被格挡则为 true。 |
− | float - | + | ** '''float''' - 计算的伤害。 |
− | float - | + | ** '''float''' - 伤害加成来源于agents的相对速度。这个值是加成的乘积,例如 0.2 代表 20% 移动速度伤害加成。注意远程攻击没有移动速度加成。 |
− | float - | + | ** '''float''' - 攻击的距离。 |
− | AgentAttackType - | + | ** '''AgentAttackType''' - 攻击的种类。 |
− | float - | + | ** '''float''' - 射击难度,只有远程攻击才使用。 |
− | int - | + | ** '''int''' - 使用武器的索引(index)。 |
− | OnAgentMount(Agent) - | + | * '''OnAgentMount(Agent)''' - 当 agent 上马时调用。 |
− | Agent - | + | ** '''Agent''' - 骑手 agent. |
− | OnAgentDismount(Agent) - | + | * '''OnAgentDismount(Agent)''' - 当 agent 下马时调用。 |
− | Agent - | + | ** '''Agent''' - 骑手 agent. |
− | OnAgentControllerChanged(Agent) - | + | * '''OnAgentControllerChanged(Agent)''' - 当 agent 的控制改变时调用。 |
− | Agent - | + | ** '''Agent''' - 改变了控制者的 agent。 |
− | OnItemPickup(Agent, SpawnedItemEntity) - | + | * '''OnItemPickup(Agent, SpawnedItemEntity)''' - 当 agent 捡起物品时调用。 |
− | Agent - | + | ** '''Agent''' - 捡起物品的 agent。 |
− | SpawnedItemEntity - | + | ** '''SpawnedItemEntity''' - 捡起的物品。 |
− | OnFocusGained(Agent, IFocusable, bool) - | + | * '''OnFocusGained(Agent, IFocusable, bool)''' - 当一个对象被 agent 关注时调用。 |
− | Agent - | + | ** '''Agent''' - 似乎总是主 agent 。 |
− | IFocusable - | + | ** '''IFocusable''' - 获得关注的对象。对于会话而言,听(侦听)与说(发送)的区别在于谁在说话。对于其它情况则可以使agents、物品和坐骑。 |
− | bool - True | + | ** '''bool''' - 如果关注的对象是可交互的则为 True 。目前 agents、坐骑和可使用的物品是可交互的。 |
− | OnFocusLost(Agent, IFocusable) - | + | * '''OnFocusLost(Agent, IFocusable)''' - 当一个对象失去关注时调用。 |
− | Agent - | + | ** '''Agent''' - 似乎总是主 agent 。 |
− | IFocusable - | + | ** '''IFocusable''' - 失去关注的对象。 |
− | Agent - | + | ** '''Agent''' - 正在交互的 agent. |
− | Agent - | + | ** '''Agent''' - 目标 agent. |
− | OnObjectUsed(Agent, UsableMissionObject) - | + | * '''OnObjectUsed(Agent, UsableMissionObject)''' - 当 agent 使用一个对象时调用。 |
− | Agent - | + | ** '''Agent''' - 用户 agent. |
− | UsableMissionObject - | + | ** '''UsableMissionObject''' - 使用的对象。 |
− | OnObjectStoppedBeingUsed(Agent, UsableMissionObject) - | + | * '''OnObjectStoppedBeingUsed(Agent, UsableMissionObject)''' - 当一个 agent 停止使用一个对象时调用。 |
− | Agent - | + | ** '''Agent''' - 用户 agent. |
− | UsableMissionObject - | + | ** '''UsableMissionObject''' - 使用的对象。 |
− | bool IsThereAgentAction(Agent, Agent) - | + | * '''bool IsThereAgentAction(Agent, Agent)''' - 在决定 agent 是否正与其他 agent 交互时调用,注意任何返回True的行为都将导致最终返回True。 |
− | OnAgentInteraction(Agent, Agent) - | + | * '''OnAgentInteraction(Agent, Agent)''' - 当一个 agent 与其他 agent 交互时调用,目前似乎只有目标agent是人时才会调用。 |
− | Agent - | + | ** '''Agent''' - 主动交互的 agent. |
− | Agent - | + | ** '''Agent''' - 目标 agent. |
− | OnAssignPlayerAsSergeantOfFormation(Agent) - | + | * '''OnAssignPlayerAsSergeantOfFormation(Agent)''' - 当一个 agent 被安排到阵型当中时调用。当前似乎只有一个玩家被指定为军士时才会调用。 |
− | Agent - | + | ** '''Agent''' - 军士 agent. |
− | OnAgentPanicked(Agent) - | + | * '''OnAgentPanicked(Agent)''' - 当一个 agent 恐慌时调用。当前,只有在逃离时才会造成恐慌。 |
− | Agent - | + | ** '''Agent''' - 恐慌的 agent. |
− | OnAgentAlarmedStateChanged(Agent, Agent.AIStateFlag) - | + | * '''OnAgentAlarmedStateChanged(Agent, Agent.AIStateFlag)''' - 当 agents 警觉状态改变时调用。 |
− | Agent - | + | ** '''Agent''' - 警觉状态改变的 agent。 |
− | Agent.AIStateFlag - | + | ** '''Agent.AIStateFlag''' - 已添加的状态标记。 |
− | OnGetAgentState(Agent, bool) - | + | * '''OnGetAgentState(Agent, bool)''' - 当一个 agent 的状态确认被击杀后调用。 |
− | Agent - | + | ** '''Agent''' - 被确定状态的 agent。 |
− | bool - True | + | ** '''bool''' - 如果是有外科医生则为 True ,似乎是用来增加医术经验的。 |
− | OnEarlyAgentRemoved(Agent, Agent, AgentState, KillingBlow) - | + | * '''OnEarlyAgentRemoved(Agent, Agent, AgentState, KillingBlow)''' - agent 的状态改为 Active 之外的其它东西时调用,在 '''OnAgentRemoved''' 之前调用。 |
− | Agent - | + | ** '''Agent''' - 状态改变的 agent。 |
− | Agent - | + | ** '''Agent''' - 造成状态改变的 agent。例如攻击者,可以为空(null)。 |
− | AgentState - | + | ** '''AgentState''' - agent 的新状态。 |
− | KillingBlow - | + | ** '''KillingBlow''' - 打击的相关信息,当状态的改变是因为打击的话。 |
− | OnAgentRemoved(Agent, Agent, AgentState, KillingBlow) - | + | * '''OnAgentRemoved(Agent, Agent, AgentState, KillingBlow)''' - agent 的状态改为 Active 之外的其它东西时调用。 |
− | Agent - | + | ** '''Agent''' - 状态改变的 agent。 |
− | Agent - | + | ** '''Agent''' - 造成状态改变的 agent。例如攻击者,可以为空(null)。 |
− | AgentState - | + | ** '''AgentState''' - agent 的新状态。 |
− | KillingBlow - | + | ** '''KillingBlow''' - 打击的相关信息,当状态的改变是因为打击的话。 |
− | OnAgentDeleted(Agent) - | + | * '''OnAgentDeleted(Agent)''' - 当一个 agent 准备删除时调用。这在 '''OnAgentRemoved''' 后调用。 |
− | Agent - | + | ** '''Agent''' - 已删除的 agent 。 |
+ | </big> | ||
== <big>其它</big> == | == <big>其它</big> == |
於 2020年4月26日 (日) 14:51 的最新修訂
訪問源文檔
返回目錄
任務行為(Mission Behaviours)被用來控制 Mission,可以做任何事,從生成 Agent 到添加任務邊界,一個任務可以有任何數量的任務行為。
MissionLogic 和 MissionViews 都是任務行為的一種(繼承自 MissionBehaviour)。
屬性
- BehaviourType - 任務行為的類型,目前可以是 Logic 或 Other。 MissionLogic 實例是 Logic,對於其它任務行為建議使用 Other 。
- DebugInput - IInputContext 實例用於調試。注意正式發行版這實例可能不會工作。
- Mission - 任務行為的 Mission。如果將相同的任務行為實例添加到多個任務,則此屬性將保存最後一個任務。請注意,除非您知道自己在做什麼,否則不建議在多個任務中使用相同的任務行為實例。
Mission 回調
- OnAfterMissionCreated() - 在 C# 端任務創建後調用,這個回調的調用是任務行為的首個調用。但是,在任務創建之後的調用不會調用這個回調。
- OnBehaviourInitialize() - 任務完全創建後調用。初始化推薦使用此回調。如果任務行為(包括官方提供的)在任務創建後被添加,則應手動調用此回調。
- OnCreated() - 每當任務行為被添加到任務中時被調用。
- EarlyStart() - 任務開始時調用,在 AfterStart 回調之前。
- AfterStart() - 任務開始時調用。
- OnRenderingStarted() - 場景開始渲染時調用。
- OnPreMissionTick(float) - 引擎端Tick開始時調用。
- float - 距離上次Tick的時間。
- OnPreDisplayMissionTick(float) - 在任務Tick開始時調用。注意這在 agents 和 teams 開始Tick之前調用,同時也在 OnMissionTick 之前調用。
- float - 距離上次Tick的時間。
- OnMissionTick(float) - 每幀調用。
- float - 距離上次Tick的時間。
- OnMissionActivate() - 當一個停用的任務激活時調用。
- OnMissionDeactivate() - 當一個任務停用時調用。
- OnMissionModeChange(MissionMode, bool) - 當任務模式改變時調用。
- MissionMode - 舊模式。
- bool - True 代表是任務開始的時刻。
- OnClearScene() - 場景被清理時調用。注意這是在 OnRemove 和 OnDelete 的場景中所有調用的Agents之後調用的。推薦使用此回調用於任務結束時的調用。
- HandleOnCloseMission() - 任務將要結束時調用。推薦複寫和使用此回調。更傾向於用 OnEndMission 這類回調來處理任務結束。
- OnEndMission() - 任務正在結束時調用。推薦在任務結束時使用此回調。也推薦使用這個來註銷掉註冊的事件。
- OnRemoveBehaviour() - 當任務行為從任務中移除時調用。注意任務行為會在任務結束時移除,在資源清理和 OnEndMission 回調之後。
Agent 回調
- OnAgentCreated(Agent) - 在引擎端創建 Agent 後調用,在 OnAgentBuild 之前調用。推薦使用此回調給 Agent 增加組件。
- Agent - 已創建的 agent.
- OnAgentBuild(Agent, Banner) - 在一個 Agent 構建完成並且準備使用,但在開始使用之前調用。這個回調推薦用於任務生成 Agent。
- Agent - 已構建的 agent.
- Banner - agent 的旗幟。注意當 agents 沒有旗幟時將使用其編隊的旗幟。
- OnAgentShootMissile(Agent, EquipmentIndex, Vec3, Vec3, Mat3, bool, int) - 當一個 agent 扔出投擲時調用。
- Agent - 射手 agent.
- EquipmentIndex - 使用的武器的索引編號(Index)。 請注意,對於使用其他物品作為彈藥的武器,如弓和弩,這裏是武器的索引,而不是彈藥的索引。
- Vec3 - 開始位置。
- Vec3 - 投擲速度矢量。
- Mat3 - 投擲武器的方位,注意這不是移動方向,而是武器本身的朝向。
- bool - 如果有剛體則為 True。
- int - 投擲的索引。似乎只用於同步服務器和客戶端,如果不是來自服務器則為 -1.
- OnMissileCollisionReaction(Mission.MissileCollisionReaction, Agent, Agent, sbyte) - 投擲命中後反饋的計算。
- Mission.MissileCollisionReaction - 已計算的反饋。
- Agent - 攻擊者 agent,可以為空(null)。
- Agent - 防禦者 agent,可以為空(null)。
- sbyte - 投擲關聯的骨架索引。
- OnMissileHit(Agent, Agent, bool) - 當投擲擊中什麼東西後會調用。
- Agent - 攻擊者 agent,可以為空(null)。
- Agent - 防禦者 agent,可以為空(null)。
- bool - 如果攻擊取消則為 True。目前當友傷未啟用時出現友傷會取消。
- OnRegisterBlow(Agent, Agent, GameEntity, Blow, AttackCollisionData) - 在所有命中計算完成後調用。
- Agent - 攻擊者 agent.
- Agent - 防禦者 agent. 可以為空(null)。
- GameEntity - 被攻擊的實體,可以為空(null)。
- Blow - 關於打擊的信息。
- AttackCollisionData - 關於攻擊的信息,也有計算結果。
- OnAgentHit(Agent, Agent, int, int, int) - agent 被擊打時調用。
- Agent - 被擊打的 Agent 。
- Agent - 攻擊者 agent,可以為空(null)。
- int - 計算的傷害。
- int - 武器種類索引(index)。注意,這是遠程武器投擲的種類的索引,而不是用來發射遠程武器的武器的索引。
- int - 使用的武器的索引。
- OnScoreHit(Agent, Agent, int, bool, float, float, float, AgentAttackType, float, int) - agent 被擊打時調用,在 OnAgentHit 之後。
- Agent - 被擊打的 agent。
- Agent - 攻擊者 agent,可以為空(null)。
- int - 武器種類索引(index)。注意,這是遠程武器投擲的種類的索引,而不是用來發射遠程武器的武器的索引。
- bool - 如果擊打被格擋則為 true。
- float - 計算的傷害。
- float - 傷害加成來源於agents的相對速度。這個值是加成的乘積,例如 0.2 代表 20% 移動速度傷害加成。注意遠程攻擊沒有移動速度加成。
- float - 攻擊的距離。
- AgentAttackType - 攻擊的種類。
- float - 射擊難度,只有遠程攻擊才使用。
- int - 使用武器的索引(index)。
- OnAgentMount(Agent) - 當 agent 上馬時調用。
- Agent - 騎手 agent.
- OnAgentDismount(Agent) - 當 agent 下馬時調用。
- Agent - 騎手 agent.
- OnAgentControllerChanged(Agent) - 當 agent 的控制改變時調用。
- Agent - 改變了控制者的 agent。
- OnItemPickup(Agent, SpawnedItemEntity) - 當 agent 撿起物品時調用。
- Agent - 撿起物品的 agent。
- SpawnedItemEntity - 撿起的物品。
- OnFocusGained(Agent, IFocusable, bool) - 當一個對象被 agent 關注時調用。
- Agent - 似乎總是主 agent。
- IFocusable - 獲得關注的對象。對於會話而言,聽(偵聽)與說(發送)的區別在於誰在說話。對於其它情況則可以使agents、物品和坐騎。
- bool - 如果關注的對象是可交互的則為 True。目前 agents、坐騎和可使用的物品是可交互的。
- OnFocusLost(Agent, IFocusable) - 當一個對象失去關注時調用。
- Agent - 似乎總是主 agent。
- IFocusable - 失去關注的對象。
- Agent - 正在交互的 agent.
- Agent - 目標 agent.
- OnObjectUsed(Agent, UsableMissionObject) - 當 agent 使用一個對象時調用。
- Agent - 用戶 agent.
- UsableMissionObject - 使用的對象。
- OnObjectStoppedBeingUsed(Agent, UsableMissionObject) - 當一個 agent 停止使用一個對象時調用。
- Agent - 用戶 agent.
- UsableMissionObject - 使用的對象。
- bool IsThereAgentAction(Agent, Agent) - 在決定 agent 是否正與其他 agent 交互時調用,注意任何返回True的行為都將導致最終返回True。
- OnAgentInteraction(Agent, Agent) - 當一個 agent 與其他 agent 交互時調用,目前似乎只有目標agent是人時才會調用。
- Agent - 主動交互的 agent.
- Agent - 目標 agent.
- OnAssignPlayerAsSergeantOfFormation(Agent) - 當一個 agent 被安排到陣型當中時調用。當前似乎只有一個玩家被指定為軍士時才會調用。
- Agent - 軍士 agent.
- OnAgentPanicked(Agent) - 當一個 agent 恐慌時調用。當前,只有在逃離時才會造成恐慌。
- Agent - 恐慌的 agent.
- OnAgentAlarmedStateChanged(Agent, Agent.AIStateFlag) - 當 agents 警覺狀態改變時調用。
- Agent - 警覺狀態改變的 agent。
- Agent.AIStateFlag - 已添加的狀態標記。
- OnGetAgentState(Agent, bool) - 當一個 agent 的狀態確認被擊殺後調用。
- Agent - 被確定狀態的 agent。
- bool - 如果是有外科醫生則為 True,似乎是用來增加醫術經驗的。
- OnEarlyAgentRemoved(Agent, Agent, AgentState, KillingBlow) - agent 的狀態改為 Active 之外的其它東西時調用,在 OnAgentRemoved 之前調用。
- Agent - 狀態改變的 agent。
- Agent - 造成狀態改變的 agent。例如攻擊者,可以為空(null)。
- AgentState - agent 的新狀態。
- KillingBlow - 打擊的相關信息,當狀態的改變是因為打擊的話。
- OnAgentRemoved(Agent, Agent, AgentState, KillingBlow) - agent 的狀態改為 Active 之外的其它東西時調用。
- Agent - 狀態改變的 agent。
- Agent - 造成狀態改變的 agent。例如攻擊者,可以為空(null)。
- AgentState - agent 的新狀態。
- KillingBlow - 打擊的相關信息,當狀態的改變是因為打擊的話。
- OnAgentDeleted(Agent) - 當一個 agent 準備刪除時調用。這在 OnAgentRemoved 後調用。
- Agent - 已刪除的 agent。
其它
- OnAddTeam(Team) - 當一個編隊被加入任務時調用。在 AfterAddTeam 前調用。
- Team - 已添加的編隊。
- AfterAddTeam(Team) - 當一個編隊被加入任務後調用。
- Team - 已添加的編隊。
- OnFormationUnitsSpawned(Team) - 當一個陣型的單位生成後調用。
- Team - 陣型屬於的編隊。
- OnObjectDisabled(DestructableComponent) - 當對象被禁用時調用,當前似乎在可銷毀對象被銷毀時被調用。
- DestructableComponent - 已禁用的對象。