「MissionBehaviour」修訂間的差異

從 骑砍中文百科
跳到: 導覽搜尋
Agent 回调
Agent 回调
行 80: 行 80:
 
** '''float''' - 射击难度,只有远程攻击才使用。
 
** '''float''' - 射击难度,只有远程攻击才使用。
 
** '''int''' - 使用武器的索引(index)。
 
** '''int''' - 使用武器的索引(index)。
OnAgentMount(Agent) - Called when an agent mounts a mount.
+
* '''OnAgentMount(Agent)''' - agent 上马时调用。
Agent - Rider agent.
+
** '''Agent''' - 骑手 agent.
OnAgentDismount(Agent) - Called when an agent dismounts a mount.
+
* '''OnAgentDismount(Agent)''' - agent 下马时调用。
Agent - Rider agent.
+
** '''Agent''' - 骑手 agent.
OnAgentControllerChanged(Agent) - Called when controller of an agent is changed.
+
* '''OnAgentControllerChanged(Agent)''' - agent 的控制改变时调用。
Agent - Agent whose controller is changed.
+
** '''Agent''' - 改变了控制者的 agent。
OnItemPickup(Agent, SpawnedItemEntity) - Called whenever an agent picks an item up.
+
* '''OnItemPickup(Agent, SpawnedItemEntity)''' - agent 捡起物品时调用。
Agent - Agent who picked up.
+
** '''Agent''' - 捡起物品的 agent。
SpawnedItemEntity - Item that has been picked up.
+
** '''SpawnedItemEntity''' - 捡起的物品。
OnFocusGained(Agent, IFocusable, bool) - Called when an object gains the focus of an agent.
+
* '''OnFocusGained(Agent, IFocusable, bool)''' - 当一个对象被 agent 关注时调用。
Agent - Seems to be always main agent.
+
** '''Agent''' - 似乎总是主 agent
IFocusable - Object that has gained the focus. For conversations, listener or speaker agent depending on who is talking. For other situations can be other agents, objects or mounts.
+
** '''IFocusable''' - 获得关注的对象。对于会话而言,听(侦听)与说(发送)的区别在于谁在说话。对于其它情况则可以使agents、物品和坐骑。
bool - True if the object that gained focus is interactable. Agents, mounts and usable objects seem to be interactable at the moment.
+
** '''bool''' - 如果关注的对象是可交互的则为 True 。目前 agents、坐骑和可使用的物品是可交互的。
 
OnFocusLost(Agent, IFocusable) - Called when an object loses its focus.
 
OnFocusLost(Agent, IFocusable) - Called when an object loses its focus.
 
Agent - Seems to be always main agent.
 
Agent - Seems to be always main agent.

於 2020年4月26日 (日) 13:56 的修訂

訪問源文檔
返回目錄

任務行為(Mission Behaviours)被用來控制 Mission,可以做任何事,從生成 Agent 到添加任務邊界,一個任務可以有任何數量的任務行為。
MissionLogicMissionViews 都是任務行為的一種(繼承自 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) - Called when an object loses its focus. Agent - Seems to be always main agent. IFocusable - Object that loses focus. Agent - Interacting agent. Agent - Target agent. OnObjectUsed(Agent, UsableMissionObject) - Called when an agent uses an object. Agent - User agent. UsableMissionObject - Used object. OnObjectStoppedBeingUsed(Agent, UsableMissionObject) - Called when an agent stops using an object. Agent - User agent. UsableMissionObject - Used object. bool IsThereAgentAction(Agent, Agent) - Called to determine if an agent is interactable by another agent. Note that any of the behaviours returning True will result in a True for final calculation. OnAgentInteraction(Agent, Agent) - Called when agent interacts with another agent. Currently seems to be called only when the target agent is human. Agent - Interactor agent. Agent - Target agent. OnAssignPlayerAsSergeantOfFormation(Agent) - Called when an agent is assigned as sergeant of the formation. Currently it seems be called only when a player is assigned as sergeant. Agent - Sergeant agent. OnAgentPanicked(Agent) - Called when an agent is panicked. Currently, an agent starts fleeing when it is panicked. Agent - Panicked agent. OnAgentAlarmedStateChanged(Agent, Agent.AIStateFlag) - Called when an agents alarm state is changed. Agent - Agent whose alarm state is changed. Agent.AIStateFlag - Added state flag. OnGetAgentState(Agent, bool) - Called when an agent's state after a killing blow is determined. Agent - Agent whose state is determined. bool - True if surgery is excersized. Seems to be used for granting experience to surgery. OnEarlyAgentRemoved(Agent, Agent, AgentState, KillingBlow) - Called when an agent's state change to something other than Active. Called before OnAgentRemoved. Agent - Agent whose state is changed. Agent - Agent causing the state change, e.g. attacker. Can be null. AgentState - New state of the agent. KillingBlow - Information about the blow if change was due to a hit. OnAgentRemoved(Agent, Agent, AgentState, KillingBlow) - Called when an agent's state change to something other than Active. Agent - Agent whose state is changed. Agent - Agent causing the state change, e.g. attacker. Can be null. AgentState - New state of the agent. KillingBlow - Information about the blow if change was due to a hit. OnAgentDeleted(Agent) - Called when an agent is about to be deleted. This is called after OnAgentRemoved callbacks. Agent - Deleted agent.

其它

  • OnAddTeam(Team) - 當一個編隊被加入任務時調用。在 AfterAddTeam 前調用。
    • Team - 已添加的編隊。
  • AfterAddTeam(Team) - 當一個編隊被加入任務後調用。
    • Team - 已添加的編隊。
  • OnFormationUnitsSpawned(Team) - 當一個陣型的單位生成後調用。
    • Team - 陣型屬於的編隊。
  • OnObjectDisabled(DestructableComponent) - 當對象被禁用時調用,當前似乎在可銷毀對象被銷毀時被調用。
    • DestructableComponent - 已禁用的對象。