「MissionBehaviour」修訂間的差異

出自 骑砍中文百科
前往: 導覽搜尋
Agent 回调
Agent 回调
行 51: 行 51:
 
** '''Mission.MissileCollisionReaction''' - 已计算的反馈。
 
** '''Mission.MissileCollisionReaction''' - 已计算的反馈。
 
** '''Agent''' - 攻击者 agent,可以为空(null)。
 
** '''Agent''' - 攻击者 agent,可以为空(null)。
** '''Agent''' - 防御者 agent,可以为空(null
+
** '''Agent''' - 防御者 agent,可以为空(null)
 
** '''sbyte''' - 投掷关联的骨架索引。
 
** '''sbyte''' - 投掷关联的骨架索引。
OnMissileHit(Agent, Agent, bool) - Called whenever a missile hits something.
+
* '''OnMissileHit(Agent, Agent, bool)''' - 当投掷击中什么东西后会调用。
Agent - Attacker agent. Can be null.
+
** '''Agent''' - 攻击者 agent ,可以为空(null)。
Agent - Defender agent. Can be null.
+
** '''Agent''' - 防御者 agent ,可以为空(null)。
bool - True if hit is canceled. Currently a hit is canceled when it is friendly fire and friendly fire is not enabled.
+
** '''bool''' - 如果攻击取消则为 True 。目前当友伤未启用时出现友伤会取消。
OnRegisterBlow(Agent, Agent, GameEntity, Blow, AttackCollisionData) - Called after all the calculations for a hit is made.
+
* '''OnRegisterBlow(Agent, Agent, GameEntity, Blow, AttackCollisionData)''' - 在所有命中计算完成后调用。
Agent - Attacker agent.
+
** '''Agent''' - 攻击者 agent.
Agent - Defender agent. Can be null.
+
** '''Agent''' - 防御者 agent. 可以为空(null)。
GameEntity - Entity that has been hit. Can be null.
+
** '''GameEntity''' - 被攻击的实体,可以为空(null)。
Blow - Information about the blow.
+
** '''Blow''' - 关于打击的信息。
AttackCollisionData - Information about the attack. Also holds result of calculation.
+
** '''AttackCollisionData''' - 关于攻击的信息,也有计算结果。
OnAgentHit(Agent, Agent, int, int, int) - Called whenever an agent is hit.
+
* '''OnAgentHit(Agent, Agent, int, int, int)''' - agent 被击打时调用。
Agent - Agent that is hit.
+
** '''Agent''' - 被击打的 Agent
Agent - Attacker agent. Can be null.
+
** '''Agent''' - 攻击者 agent ,可以为空(null)。
int - Calculated damage.
+
** '''int''' - 计算的伤害。
int - Weapon kind index of the weapon. Note that this is the kind index of missile for ranged weapons, not the weapon used to shoot it.
+
** '''int''' - 武器种类索引(index)。注意,这是远程武器投掷的种类的索引,而不是用来发射远程武器的武器的索引。
int - Weapon usage index of the weapon.
+
** '''int''' - 使用的武器的索引。
 
OnScoreHit(Agent, Agent, int, bool, float, float, float, AgentAttackType, float, int) - Called whenever an agent is hit, right after OnAgentHit.
 
OnScoreHit(Agent, Agent, int, bool, float, float, float, AgentAttackType, float, int) - Called whenever an agent is hit, right after OnAgentHit.
 
Agent - Agent that is hit.
 
Agent - Agent that is hit.

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

訪問源文檔
返回目錄

任務行為(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) - Called whenever an agent is hit, right after OnAgentHit. Agent - Agent that is hit. Agent - Attacker agent. Can be null. int - Weapon kind index of the weapon. Note that this is the kind index of missile for ranged weapons, not the weapon used to shoot it. bool - True if the hit is blocked. float - Calculated damage. float - Damage bonus from relative movement speed of agents. This value is the multiplier giving just the bonus, for example 0.2 would mean 20% bonus damage from movement speed. Note that ranged hits do not have a movement speed bonus. float - Distance of the ranged hit. AgentAttackType - Type of the attack. float - Difficulty of the shot. Calculated only for ranged hits. int - Weapon usage index of the weapon. OnAgentMount(Agent) - Called when an agent mounts a mount. Agent - Rider agent. OnAgentDismount(Agent) - Called when an agent dismounts a mount. Agent - Rider agent. OnAgentControllerChanged(Agent) - Called when controller of an agent is changed. Agent - Agent whose controller is changed. OnItemPickup(Agent, SpawnedItemEntity) - Called whenever an agent picks an item up. Agent - Agent who picked up. SpawnedItemEntity - Item that has been picked up. OnFocusGained(Agent, IFocusable, bool) - Called when an object gains the focus of an agent. Agent - Seems to be always main 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. bool - True if the object that gained focus is interactable. Agents, mounts and usable objects seem to be interactable at the moment. 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 - 已禁用的對象。