Clean Code using the Strategy Pattern

preview_player
Показать описание
Unity C# Architecture: Strategy Programming Pattern in Unity C# using expert Software Engineering Principles. Modularize behaviour and enforce the Single Responsiblity Principle!

#unity3d #gamedev #indiedev

▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬

0:00 The Strategy Pattern
1:20 Shield Spell Strategy
3:38 Projectile Strategy
6:30 Orbital Spell Strategy

Extension Methods and Utils

*Assets Shown In This Video* (Affiliate Links)

*Follow me!*
Рекомендации по теме
Комментарии
Автор

24-hour Challenge! Identify a method in your existing project where you're using hardcoded values to dictate behaviour. Replace those hardcoded elements with strategies, allowing dynamic behaviour changes without modifying the existing code. Don't forget to click the LIKE button!

git-amend
Автор

I literally have an exam tomorrow about software design patterns, this video could not have been timed better. You are the best!

hetsmiecht
Автор

I know this video is quite old now but just wanted to say this is the best video I've seen on this pattern, well structured, paced and such great content. You make this very easy to understand and give great coverage on the topic. Excellent stuff.

dominiauk
Автор

Genuinely great content with concrete examples and practical advice for integrating it with Unity. So often tutorials either show coding things poorly but it seems fine in Unity (e.g. assigning a weapon directly), coding things great but no thought in how it will work with Unity (okay I have my sword but how do I get that into my characters hand!?). You do a good job of showing where things can be pure code and when you can use something like ScriptableObjects to create that bridge.

ItsDan
Автор

Your videos are incredible, keep it up I think you'll gain some popularity on here. It certainly isn't easy but I've been working in unity for a few years now and have learned a good bit the last few weeks.

derekdipietro
Автор

I hope to see your channel blow up one day! These are really useful concepts you are teaching. Many thanks!

gabrijel
Автор

I made a comment earlier but YouTube seems to have removed it. It was a short comment saying I like the video.
Thanks for showing how to apply patterns in game development. It's hard to find good videos about this. There are a lot about patterns, just not with specific game dev examples.

techdave
Автор

Another awesome video. I love these pattern videos.

techdave
Автор

Also, may sound random, but your code is just so clean and quite an inspiration

gabrijel
Автор

Thank you so much, man! Having a look right now

arjanb
Автор

Finally i found a great channel, tks Adam for sharing your knowledge

txh
Автор

If college teachers explained things this well, humanity would be several centuries ahead now.

micha
Автор

after watching your videos it looks you are gem on internet

abdullah
Автор

@git-amend at 1:30, is there a specific reason that you are locally caching the indexer and then using it in the callback while using the for-loop indexer whan accessing the array?

cursedfunction
Автор

Surprised to ever see a Unity video again

septillion.
Автор

thanks for this, it makes life easy!! :)

yashaswiification
Автор

Three spells with link to origin. But what if you add a spell with special logic? You will need to add new abstract method to base strategy class. Something like Cast Spell(Transform[] points)
All child classes will have to implement this method.

ИванСоблазн
Автор

Hey, good videos, going through all of them and you are describing it really well, so thanks! In case that you'd want for example an animation to play when a spell is cast, how would you handle it?
Would you prefer having animation controller passed as parameter in CastSpell along with origin transform?
Asking this because I am kinda using this pattern but this is something I tend to run into - I start needing access to stats, animation controller, etc and then it starts feeling like it would be easier if the hero knew about the spell so all this stuff is easily accessible, but it makes it tighter coupled and can't be reused for enemies as well for example.

TheAbsurdMn
Автор

I should advise everyone watching here that you should recycle all your objects instead of destroying or instantiating them as they have real overhead on larger scales. To have a production ready spell system you also need to think about the scale of such systems and overhead as they can negatively impact performance on mobile phones. It's also important to understand that every solution has it's own applications and no 1 solution fits all.

JacobNax
Автор

good video got to love the more advenced stuff for gamedev. what do u plan on doing after u cover all design patterns u want?

DisfavoredKin
welcome to shbcf.ru