summaryrefslogtreecommitdiff
path: root/Oneko.cs
diff options
context:
space:
mode:
authorSarah Bradley <git@sarahduck.ca>2023-12-25 17:33:39 -0800
committerSarah Bradley <git@sarahduck.ca>2023-12-25 17:33:39 -0800
commit31d9168080e52738829b5575c66627e43a8bdc38 (patch)
treeec6333bbd9b36dfa86d6e78fe94bb2c8019c6e7d /Oneko.cs
parentf6100c020613de7980861b7d77f4c37e1a65a025 (diff)
Small tweaks
Diffstat (limited to 'Oneko.cs')
-rw-r--r--Oneko.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/Oneko.cs b/Oneko.cs
index f158024..6ddefba 100644
--- a/Oneko.cs
+++ b/Oneko.cs
@@ -1,5 +1,5 @@
using System.Numerics;
-using OnekoOnline.Net;
+using System.Collections.ObjectModel;
using Raylib_cs;
namespace OnekoOnline;
@@ -17,6 +17,9 @@ abstract class Oneko : Drawable
public string Name = "Oneko";
+ protected static List<Oneko> allNekos = [];
+ public static ReadOnlyCollection<Oneko> AllNekos => allNekos.AsReadOnly();
+
protected readonly static byte[] FallbackImg = EmbeddedResources.GetResource("nekos.oneko.png");
public Oneko() : base()
@@ -32,6 +35,8 @@ abstract class Oneko : Drawable
Console.WriteLine("Path to spritesheet was invalid or the file was too big, using the default.");
SpriteSheet = Bitmap.FromPNGMemory(FallbackImg, 256, 128);
}
+
+ allNekos.Add(this);
}
public Oneko(Bitmap spriteSheet) : base()
@@ -39,6 +44,8 @@ abstract class Oneko : Drawable
Size = new(32,32);
Position = new(0, 0);
SpriteSheet = spriteSheet;
+
+ allNekos.Add(this);
}
public override void Draw()
@@ -54,6 +61,7 @@ abstract class Oneko : Drawable
public override void Dispose()
{
+ allNekos.Remove(this);
SpriteSheet.Dispose();
base.Dispose();
}