【Unity3D】RTS Engine 笔记五

Setup Unit Movement | Unity RTS Engine Documentation

目录

Setup Unit Movement | Unity RTS Engine Documentation

5.2 配置单位移动

5.2.1 通用选项卡

​编辑

5.2.2 设置目标选项卡

5.2.3 移动选项卡​编辑

5.2.4 旋转选项卡​编辑

5.2.5 网格移动

5.2.6 移动管理器​编辑

5.3 添加单位到地图

5.3.1 将单位添加到派系(Add Unit to Faction Slot)

5.3.2 将单位添加到自由派系


5.2 配置单位移动

  • 5.2.1 通用选项卡

  • Code:  代码标识
  • Is Active: 是否启用
  • Priority: 没理解, 说是给目标设置优先级

        When an entity has multiple entity components that allow to have targets, the player can have the entity selected and then right-clicks on a target in the map to assign one of the components a target. This field defines the order in which the components will be considered to set the target. The component with the lowest priority value will be considered first and if it does not allow the target that the player sets, then the component with the next higher priority value will be considered next until one component accepts the target as valid. In our case, we only currently have the Unit Movement component as an entity component on the unit, therefore we can leave the priority set to 0.

5.2.2 设置目标选项卡

  • Set Target Task UI:  允许玩家在实体被选中时通过右键或在实体被选中时通过UI任务面板中的UI设置目标。这个涉及到里边的各种“任务配置”也就是一些诸如创建,更新,设置等等的一些配置任务,这个以后会再讲
  • Order Audio:  执行移动指令时播放的音频
5.2.3 移动选项卡
  •  Movable Terrain Areas: 可移动地形区域。可以选择也可以空着,空着代表可以在任何区域移动
  • Formation: 组成物。多个同类型的单位移动时存在队形移动。目前有两种队形,也可以自定义队形
  • Float Properties: 定义队形间距。vertical-spacing 横间距,horizontal-spacing 纵间距 ,如果两个值相同也可只有 spacing 一项
  • Int Properties: 允许输入整数值,但是只有一个属性-amountPerRow(每行的数量)。它定义要为每行生成的路径目的地的数量。
  • Movement Priority: 移动优先级。值越低越靠前。用于多种物体间的移动算法,当框选很多不同的单位时会很有用。
  • Speed: 单位默认移动速度
  • Acceleration: 加速。单位移动的加速度,单位在开始移动时是从单位的当前速度开始移动的,如果当前速度是0则会通过加速度慢慢加速到指定的移动速度
  • Movement Audio: 移动音效。只要单位在移动,音频就会循坏
  • Invalid Path Audio: 无效路径音频。当一个单位被命令移动到一个不能移动到的目的地时的音频
5.2.4 旋转选项卡
  • Angular Speed:角速度
  • Can Move Rotate: 允许单位在移动时旋转。
  • Can Idle Rotate:可闲置旋转
    • Smooth Idle Rotation:平滑闲置旋转
      • Idle Angular Speed:旋转速度
5.2.5 网格移动

回到单位的父节点中的 Nav Mesh Agent(Unity 自己的寻路系统,一言难尽,RTSEngine支持其他的寻路系统)

  • Obstacle Avoidance: 障碍物避让。
  • Path Finding: 寻路。都打勾,Area Mask 选Walkable
5.2.6 移动管理器
  •  Movement Manager: 处理单元移动的主要管理器组件
    • Stopping Distance: 单元在到达目的地之前停止的距离
    • Movement Target Effect Prefab: 移动目标效果预制。目标的提示效果
  • Navmesh Movement System: 将 MovementManager 链接到Unity的导航系统
  • Movement Formation Handler: 移动队形处理器,对队形的处理。
  • Fallback Formation Type: 后备编队。寻路失败的处理。当处理程序组件在尝试了最大空尝试次数之后无法为给定的编队找到合适的路径目的地时,并且它有一个分配给此字段的编队类型,那么它将调用后备编队类型的处理程序来生成路径目的地。例如,圆形队形处理程序没有后备队形类型,但行将圆形队形处理程序作为其后备队形类型。
  • Max Empty Attempts:最大空尝试
  • 当创建自己的阵型时,需要创建一个组件来处理生成路径目的地,如上边的Handler

5.3 添加单位到地图

5.3.1 将单位添加到派系(Add Unit to Faction Slot)
5.3.2 将单位添加到自由派系

在UnitExtension中添加,添加的脚本: UnitManager

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值