From 958a75552f8916ec8a77bc78d901e9594dd7aa12 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Tue, 30 Jan 2024 12:15:26 +0300 Subject: [PATCH] refactor: MonoGameCamera --- Game/Behaviours/MonoGameCameraBehaviour.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Game/Behaviours/MonoGameCameraBehaviour.cs b/Game/Behaviours/MonoGameCameraBehaviour.cs index 06297c0..09e5d19 100644 --- a/Game/Behaviours/MonoGameCameraBehaviour.cs +++ b/Game/Behaviours/MonoGameCameraBehaviour.cs @@ -1,5 +1,3 @@ -using System; - using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -10,11 +8,11 @@ namespace Pong.Behaviours; public class MonoGameCameraBehaviour : BehaviourOverride { - public Action? OnPositionChanged { get; set; } = null; - public Action? OnMatrixTransformChanged { get; set; } = null; - public Action? OnViewportChanged { get; set; } = null; - public Action? OnRotationChanged { get; set; } = null; - public Action? OnZoomChanged { get; set; } = null; + public System.Action? OnPositionChanged { get; set; } = null; + public System.Action? OnMatrixTransformChanged { get; set; } = null; + public System.Action? OnViewportChanged { get; set; } = null; + public System.Action? OnRotationChanged { get; set; } = null; + public System.Action? OnZoomChanged { get; set; } = null; private Matrix _matrixTransform = Matrix.Identity; @@ -59,7 +57,7 @@ public class MonoGameCameraBehaviour : BehaviourOverride get => _zoom; set { - float newValue = value >= .1f ? value : .1f; + float newValue = Math.Max(0.1f, value); if (_zoom == newValue) return;