当前位置:网站首页>How to implement a grid construction system
How to implement a grid construction system
2022-08-10 06:13:00 【Youmeng Maker】
版权声明
- 本文为“优梦创客”原创文章,您可以自由转载,但必须加入完整的版权声明
- 更多学习资料请加QQ:1517069595获取(企业级性能优化/Shader特效/热更新/shader特效/服务器/商业项目实战/每周直播/一对一指导)
What our build system is trying to achieve:
- WASD在地图上移动
- 按1~6key to switch the construction unit type
- Building units can occupy multiple grids
- Left click to execute build(Has a build effect)
- Rkey and change the construction direction
- Right click to destroy built in units
- Can't overlap builds
Defines the underlying grid data structure
Define building prefabs,点击创建实例
点击创建实例
Resolve creation location overlap
Can only be created inside a grid(cannot be crossed)
- Get the grid position based on the mouse position
- This ensures that it is drawn within the grid
- 思考:How to get grid position from mouse position?
Make sure not to overlap builds
Configure the data for each building unit
Resolved cross grid building unit overlap
解决方法:
- Get all grid coordinates occupied by building units(如何实现?)
- Find grid objects based on grid coordinates
- Set these meshes to be occupied by the building being created
- 思考:如何实现GetPositionList?
Made building unit creation direction rotatable(难点)
Define the axis of rotation(在Step2)
- Defines the current orientation
- Define rotation rules
- How to keep the rotation within the same grid area?
- 思考如何实现:
- GetNextDir
- GetRotationOffset
- GetRotationAngle
Press the button to switch the type of building unit
- Build a list of building unit types
- By default, create a new section0types of buildings
Create building placement preview effects
- GridObjectstore insteadPlaceObject
- 存储PlaceObject到GridObject
Right-click to clear the preview object
Use the placement effect
Business advancement
- How to achieve building unit upgrades?
- 升级系统(数据配置、UI界面、升级逻辑、服务器交互…)
- How to realize the construction unitAI?
- Abstraction of architectural units:
- 怪物:自动战斗
- 角色:自主行为(休息、工作、娱乐、生活)、with in-scenario prop units(such as driving facilities)的交互
- 设施:Auto-travel taxis、Playground facilities, etc
- 资源:extractable material、Pickup items、障碍…
- What if there are hundreds of buildings?
- What if different player types could build different types of buildings?
- How to add building game unitsUI操作界面?
- How to play online?
更多学习资源请加QQ:1517069595获取(/企业级性能优化/热更新/Shader特效/服务器/商业项目实战/每周直播/一对一指导)
完整视频可以点击B站链接:https://www.bilibili.com/video/BV1TK4y1g7Se
边栏推荐
猜你喜欢
随机推荐
每日刷题(day02)——leetcode 622. 设计循环队列
详解样条曲线(上)(包含贝塞尔曲线)
STM32单片机OLED俄罗斯方块单片机小游戏
二次元卡通渲染-着色
51单片机教室人数进出统计检测数码管显示装置红外传感器
酸回收工艺原理
在TypeScript中使用parseInt()
【fiddler3】使用fiddler设置弱网模式
三种素数筛总结——(朴素筛,埃氏筛,线性筛)
STM32单片机OLED经典2048游戏单片机小游戏
clickhouse出现数据重复问题
C陷阱与缺陷 个人阅读笔记
碳酸锂、碳酸氢锂溶液除钙镁离子工艺原理
请亲们关注下我,谢谢了。
STM32F407ZG PWM
酸回收工艺讲解
Unity中实现Animation Clip动画片段的倒播(该案例可以防止动画延迟)
优化Mysql运行OrderBy性能
51单片机智能蓝牙APP加油站火灾预警安防防控报警监控系统MQ2DHT11
开源游戏服务器框架NoahGameFrame(NF)服务器端环境搭建(二)