From 127693e2af931d4ac2cd8cb6aa2120afcaf20904 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Tue, 10 Mar 2020 15:06:25 -0400 Subject: [PATCH] make Camera & NPC fields readonly --- Shared/Camera.cs | 3 ++- Shared/NPC.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Shared/Camera.cs b/Shared/Camera.cs index 7b76727..98de030 100644 --- a/Shared/Camera.cs +++ b/Shared/Camera.cs @@ -13,8 +13,9 @@ namespace SemiColinGames { public int Top { get => bbox.Top; } public Point HalfSize { get => new Point(Width / 2, Height / 2); } + private readonly Random random = new Random(); private float shakeTime = 0.0f; - private Random random = new Random(); + public Matrix Projection { get => Matrix.CreateOrthographicOffCenter(Left, Left + Width, Height, 0, -1, 1); diff --git a/Shared/NPC.cs b/Shared/NPC.cs index 064d463..88d5bcc 100644 --- a/Shared/NPC.cs +++ b/Shared/NPC.cs @@ -52,7 +52,7 @@ namespace SemiColinGames { private const int spriteCenterYOffset = 2; private readonly Vector2 eyeOffset = new Vector2(4, -3); - private FSM fsm; + private readonly FSM fsm; public NPC(Point position, int facing) { Position = position;