“MissionBehaviour”的版本间的差异

来自骑砍中文百科
跳转至: 导航搜索
Agent 回调
Agent 回调
第37行: 第37行:
 
* '''OnAgentCreated(Agent)''' - 在引擎端创建 Agent 后调用,在 OnAgentBuild 之前调用。推荐使用此回调给 Agent 增加组件。
 
* '''OnAgentCreated(Agent)''' - 在引擎端创建 Agent 后调用,在 OnAgentBuild 之前调用。推荐使用此回调给 Agent 增加组件。
 
** '''Agent''' - 已创建的 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) - Called whenever a missile hits something.
 +
Agent - Attacker agent. Can be null.
 +
Agent - Defender agent. Can be null.
 +
bool - True if hit is canceled. Currently a hit is canceled when it is friendly fire and friendly fire is not enabled.
 +
OnRegisterBlow(Agent, Agent, GameEntity, Blow, AttackCollisionData) - Called after all the calculations for a hit is made.
 +
Agent - Attacker agent.
 +
Agent - Defender agent. Can be null.
 +
GameEntity - Entity that has been hit. Can be null.
 +
Blow - Information about the blow.
 +
AttackCollisionData - Information about the attack. Also holds result of calculation.
 +
OnAgentHit(Agent, Agent, int, int, int) - Called whenever an agent is hit.
 +
Agent - Agent that is hit.
 +
Agent - Attacker agent. Can be null.
 +
int - Calculated damage.
 +
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 - Weapon usage index of the weapon.
 +
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.
  
 
== <big>其它</big> ==
 
== <big>其它</big> ==

2020年4月26日 (日) 13:08的版本

访问源文档
返回目录

任务行为(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) - Called whenever a missile hits something. Agent - Attacker agent. Can be null. Agent - Defender agent. Can be null. bool - True if hit is canceled. Currently a hit is canceled when it is friendly fire and friendly fire is not enabled. OnRegisterBlow(Agent, Agent, GameEntity, Blow, AttackCollisionData) - Called after all the calculations for a hit is made. Agent - Attacker agent. Agent - Defender agent. Can be null. GameEntity - Entity that has been hit. Can be null. Blow - Information about the blow. AttackCollisionData - Information about the attack. Also holds result of calculation. OnAgentHit(Agent, Agent, int, int, int) - Called whenever an agent is hit. Agent - Agent that is hit. Agent - Attacker agent. Can be null. int - Calculated damage. 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 - Weapon usage index of the weapon. 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 - 已禁用的对象。