Войти
  • 44663Просмотров
  • 5 лет назадОпубликованоOne Wheel Studio

Change Behaviors with the Strategy Pattern - Unity and C#

The strategy pattern is all about encapsulating or wrapping up a behavior or algorithm in its own class. It has the added bonus of allowing behaviors or algorithms to be assigned at runtime! If you have a mess of if statements or switch statements trying to control or adjust behaviors then the strategy pattern might just be what you need to clean up your code. 0:00 Intro 0:37 Problems Solved 2:51 Strategy Pattern 3:11 Interface Definition 3:32 Interface Instance Variable 4:05 Fire Damage Example 5:12 Ice Damage Example 5:25 Generic Weapon 5:39 Changing Behaviors 6:25 Combination of Behaviors 6:51 Final Thoughts 7:56 THE END Blog Post of Strategy Pattern: Game Programming Pattern Book (affiliate): Become A Channel Member: New Merch: My video and streaming kit: Recommended Game Design Books: Discord: Patreon: Twitter: Devlog: Twitch: #programmingpatterns #strategypattern #unitytutorial #csharp