ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Unity Progress #42: First Attempt at a Build System!

Автор: Indie Progress

Загружено: 2019-07-21

Просмотров: 631

Описание: So I saw some videos on the Unity Asset Store of people making build systems to create player housing. Being that one of the classes in my game will be the engineer he will be able to create tools, (e.g. Axe, Hoe) technology (e.g. sprinklers, vehicles) and building items (e.g. walls, floors, furniture). I'm thinking the tier of item/material built will depend on the tier of the tool (e.g. copper hammer, iron hammer, etc.)

Anyway I thought it was cool so I wanted to take a stab at making a system that fit into the systems of the game. For this first attempt I created the floor, wall and roof. The programming used to create what is shown in the video can be seen below:

#1. Hammer - Equipping the hammer (shown as a default icon of swords for now...lol) activates the building system.

#2. Floor - Pressing 'F' will set the active build structure to Floor. On Raycast if the mouse is on a Gameobject tagged "Ground", the active Floor will show at the mouse position. If the left mouse and the floor is in an available space, the active structure will be null, leaving the gameobject in that position. If the active structure is null and there are enough resources to instantiate a new structure at mouse position it will do so. Dropping the active structure will allow enable four box colliders. These are slots for either a floor or wall to go on. Once a slot is filled that new structure becomes the child of that slot (north, south, east, west). If there is a child already in that slot (e.g. wall or floor) nothing can be dropped in that slot.

#3. Wall - Pressing 'L' will set the active build structure to Wall. If Raycast hits an active build slot on a Floor Gameobject the wall will lock to that position. Depending on the direction (n, s, e, w) the wall will be rotated accordingly.

#4. Roof - The Roof is actually just a Floor that can be locked to the 'top' slot of a floor Gameobject (only if one of the floor's children is a wall). This is to prevent a floating roof.

I will eventually add some UI to allow the player to choose different structures, and models, but for right now I like the basic system in place. I don't even need to add any Scripts to the actually structures as the Build Mode script is attached to the hammer GameObject. I think it also creates some uniqueness for the class as only players' wielding a particular tier hammer can build different tier structures such as wood, stone, metal, etc..

I have many other ideas to expand the building system, but for now I'm happy with what I've accomplished for my first attempt.

I also added music to this one, as I've had many requests. Eventually I'd like to learn to make my own, but for now the free music I used is in the link below!

Thanks for watching!

   • (Free Music for Vlogs) LiQWYD - Vibes  

Twitter:   / indieprogress  
Facebook:   / indieprogress3  
Instagram:   / indieprogress  

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Unity Progress #42:  First Attempt at a Build System!

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]