Learning Design Patterns Through Games: Strategy Pattern

preview_player
Показать описание
We take a look at the Strategy Design Pattern and see how it can be implemented within a FPS.
Рекомендации по теме
Комментарии
Автор

This video helped me a lot to understand the strategy pattern! Is there a possibility of a tutorial where I mix Strategy with a generic ObjectPool of different bullets?

nicolasferreiro
Автор

First of all thank you. I am currently looking into design patterns and specifically in conjunction with Unity and this was one of the better Tutorials I found on the Strategy Pattern in that context. So please consider my next question not as a commentary or critique, but just as an attempt to *really* get things down.

I noticed the reuse of the code for the SingleshotBehaviour in InitFiringBehaviors methods in the FiringWeaponStrategy class and the PistolStrategy class. Would it be possible to also make an interface for Initfirebehaviours that you implement differently in the FiringWeaponStrategy class and the PistolStrategy class; the former implementing al 3 firebehaviours and the latter only implementing the singleshot?

Thanks in advance for your reply, and thanks once more for the tutorial!

mikeyramones