查看“MissionBehaviour”的源代码
←
MissionBehaviour
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
该页面已被保护以防止编辑和其他操作。
您可以查看与复制此页面的源代码。
[https://docs.bannerlordmodding.com/_csharp-api/mountandblade/missionbehaviour/ <big>访问源文档</big>]<br> [[骑马与砍杀2:霸主 MOD API|<big>返回目录</big>]]<br> <br> <big>任务行为(Mission Behaviours)被用来控制 [[Mission]],可以做任何事,从生成 [[Agent]] 到添加任务边界,一个任务可以有任何数量的任务行为。<br> [[MissionLogic]] 和 [[MissionView|MissionViews]] 都是任务行为的一种(继承自 MissionBehaviour)。</big><br> == <big>属性</big> == <big> * '''BehaviourType''' - 任务行为的类型,目前可以是 Logic 或 Other。 MissionLogic 实例是 Logic,对于其它任务行为建议使用 Other 。 * '''DebugInput''' - IInputContext 实例用于调试。注意正式发行版这实例可能不会工作。 * '''Mission''' - 任务行为的 [[Mission]]。如果将相同的任务行为实例添加到多个任务,则此属性将保存最后一个任务。请注意,除非您知道自己在做什么,否则不建议在多个任务中使用相同的任务行为实例。</big> == <big>Mission 回调</big> == <big> * '''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''' 回调之后。</big> == <big>Agent 回调</big> == * '''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. == <big>其它</big> == <big> * '''OnAddTeam(Team)''' - 当一个编队被加入任务时调用。在 AfterAddTeam 前调用。 ** '''Team''' - 已添加的编队。 * '''AfterAddTeam(Team)''' - 当一个编队被加入任务后调用。 ** '''Team''' - 已添加的编队。 * '''OnFormationUnitsSpawned(Team)''' - 当一个阵型的单位生成后调用。 ** '''Team''' - 阵型属于的编队。 * '''OnObjectDisabled(DestructableComponent)''' - 当对象被禁用时调用,当前似乎在可销毁对象被销毁时被调用。 ** '''DestructableComponent''' - 已禁用的对象。</big>
返回至
MissionBehaviour
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
不转换
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
台灣正體
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
Help about MediaWiki
工具
链入页面
相关更改
特殊页面
页面信息