编辑器/功能拓展 2D Line Of Sight Detection System 1.0视线检测

1_resized.jpg 9cc77deb-ccea-42c2-b0fe-ea27091a_resized.jpg 66c7a24d-092d-4b81-83ab-316fddc3_resized.jpg
This asset package contains scripts/prefabs to help you build you Canvas based 2D games that need line of sight detection with visible/invisible FOV cones. The asset includes 2 demo scenes one for top-down, one for sidescrolling behavior. The system is designed to be variable in it's performance impact and runs well on mobile as well on PCs.

The project has been developed with Unity 2019.3 but also works with 2019.2. Previous Unity Versions are not supported by the custom editor and the prefabs.

Features:
- Custom Editor for easy setup
- Multiple options to tailor the performance for your target (Mobile/Desktop)
- Highly customizable
- Variable FOV from 1° - 180° degrees
- Variable detection distance
- Automatic rotation from 1° - 180° degrees to the left/right (can stop on detection) with variable speed
- The FOV cone can be set to visible/invisible
- Color for detected/undetected can be set and animated
- Custom sprites for detected/undetected state can be set for the FOV cone
- Multiple tags which trigger detection can be set
- Multiple layers on which the raycast for the line of sight detection is being made can be set
- Raycast only happens when a target object enters the detection radius of the search object
- Detection interval (when the raycast is made) can be set between 0.1 and 5.0 seconds to save on performance
- The density of the rays used for the raycast is variable to save on performance
- The search direction can be toggle from middle to the outside or outside to the middle
- In the editor debug rays can be drawn during gameplay to help debugging gameplay
- Custom Unity Events can be added via the editor when an object is detected or has been lost by detection. The events pass the GameObject of the detector as well as the detected object to easily implement further functions
- Helper function to rotate elements with the FOV cone is included

The code is extensively commented and a pictured pdf documentation is included.


此资产包包含脚本/预制件,可帮助您构建基于Canvas的2D游戏,这些游戏需要使用可见/不可见FOV圆锥体进行视线检测。该资产包括两个演示场景,一个用于自上而下,另一个用于侧滑行为。该系统的设计使其性能影响可变,在移动设备和PC上运行良好。
该项目已与Unity 2019.3合作开发,但也与2019.2合作。自定义编辑器和预制件不支持以前的Unity版本。
特征:
-自定义编辑器,便于设置
-多种选项可为您的目标量身定制性能(移动/桌面)
-高度可定制
-可变FOV范围为1°-180°
-可变检测距离
-可变速从1°-180°左右自动旋转(可在检测时停止)
-FOV圆锥体可以设置为可见/不可见
-可以设置检测到/未检测到的颜色并设置动画
-可以为FOV圆锥体设置检测到/未检测到状态的自定义精灵
-可以设置多个触发检测的标签
-可以设置多个层,在这些层上进行视线检测的光线投射
-射线投射仅在目标对象进入搜索对象的检测半径时发生
-检测间隔(进行光线投射时)可以设置在0.1到5.0秒之间,以节省性能
-用于光线投射的光线密度是可变的,以节省性能
-搜索方向可以从中间切换到外部或从外部切换到中间
-在编辑器中,可以在游戏过程中绘制调试射线,以帮助调试游戏
-当检测到对象或对象因检测而丢失时,可以通过编辑器添加自定义Unity事件。事件通过检测器的游戏对象以及检测到的对象,以轻松实现进一步的功能
-包含使用FOV圆锥体旋转元素的辅助功能
该代码得到了广泛的评论,并包含了一个如图所示的pdf文档。


2024-1-22 11:50 上传
文件大小:
未知
下载次数:
0
附件售价:
28 钥匙  购买记录
本地下载 立即购买





使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册