Vibration Handling with Polymorphism in C# Godot
Polysthetic
Handle mobile/handheld vibrations in Godot C#. Vibrations are relatively simple, but introduce subtle complexities when dealing with the differences between platforms, user enabling/disabling, and vibration durations.
This is an example of how to handle these situations using a static class with polymorphic behaviour.
ā±ļø Timestamps: 0:00 Intro and problem context 1:40 Limits of procedurally-oriented design 2:50 Vibration handler and Vibrator 4:45 Polymorphism: Android vs iOS vibrators 6:50 Conclusion
š» Addendum: I forgot to explain this: notice how the BaseVibrator inherits from Godot.Object? This is to allow it to connect signals. So instead of directly calling methods on the vibrator, you can call: Connect("pressed", VibrationHandler.Vibrator, nameof(Vibrator.OnButtonPress)) for example.
š¶ Music tracks from:
- Yestalgia - Glowing
- Provided by Lofi Girl
- Watch: https://www.youtube.com/watch?v=1k8h_gB2qII
- Listen: https://open.spotify.com/album/7KRb4psz1vakIKdMQRyZSG
You can also visit me at: WEBSITE š https://polysthetic.com INSTAGRAM šø https://www.instagram.com/polysthetic/ THREADLESS š¶ļø https://polysthetic.threadless.com DRIBBBLE š https://dribbble.com/polysthetic YOUTUBE š„ https://youtube.com/c/polysthetic AUDIOMACK š¼ https://audiomack.com/polysthetic TWITTER š¦ https://twitter.com/polysthetic LINKEDIN š https://www.linkedin.com/company/polysthetic ... https://www.youtube.com/watch?v=yC6QhpCzsuw
30976994 Bytes