Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Jak robisz mała ilość tych extensionów to robisz sobie klase na wszystkie, lub
- public static class ExtensionMethods {}
- //dedykowane dla jakiejs klasy skads
- public static ClassNameExtension {}
- // tudziez idziesz na latwizne i jak robisz extensiony do wlasnych klas/whatever to mozesz w tym samym pliku
- namespace Dupa
- {
- public enum PlayerMovementState
- {
- Walking,
- Flying,
- Sliding,
- Swimming,
- Standing
- }
- public static class PlayerMovementStateExtensions
- {
- public static float GetSpeed(this PlayerMovementState movementState)
- {
- // mozesz zrobic Dictionary<PlayerMovementState, float> jak masz tego sporo
- switch(movementState)
- {
- case PlayerMovementState.Walking:
- return 0.7f;
- case PlayerMovementState.Flying:
- return 5f;
- //...
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment