Cutting down on code with Generics - Multi-Weapon System in Unity - Part 8

Published: 14 December 2022
on channel: Bardent
3,899
156

In this part we try to identify where in our weapon system we can reuse some code. Turns out all of our weapon components need data... so using generics we can cut down on quite a bit of work we need to do in the future when creating more components :D

Generics:
   • What are Generics? (C# Basics)  

All Assets:
https://drive.google.com/drive/folder...

Discord Server:
  / discord  

If you wish to support me more:
  / bardent  

GitHub link for this part:
https://github.com/Bardent/Weapon-Sys...

GitHub Repo Link:
https://github.com/Bardent/Weapon-Sys...

Player Controller Series:
   • 2D Platformer Controller  

00:00 - Intro
00:24 - What are we repeating?
01:30 - What can we do about it?
04:14 - Why we had to make a separate class
04:49 - Continue extending the WeaponComponent class
05:48 - Update Movement to use the new Generic Class
07:03 - Fixing Namespace in SO Assets
08:59 - Testing in Unity
09:25 - Upate WeaponSprite to use new Generic Class
09:55 - What else can we make more generic?
10:55 - Getting the current attack data
13:26 - Creating the AttackData base class
13:55 - Limiting T2
14:45 - Using AttackData in ComponentData
18:26 - Getting the CurrentAttackData
18:54 - Updating the two weapon components to use the generic currentAttackData
21:05 - Addressing errors caused by not removing old variables from the Component Datas
22:28 - Testing the game
23:04 - Why did we do this?
23:49 - Outro


On this page of the site you can watch the video online Cutting down on code with Generics - Multi-Weapon System in Unity - Part 8 with a duration of hours minute second in good quality, which was uploaded by the user Bardent 14 December 2022, share the link with friends and acquaintances, this video has already been watched 3,899 times on youtube and it was liked by 156 viewers. Enjoy your viewing!