summaryrefslogtreecommitdiff
path: root/OnekoNet.cs
diff options
context:
space:
mode:
authorSarah B <git@sarahduck.ca>2023-12-24 21:04:19 -0800
committerSarah B <git@sarahduck.ca>2023-12-24 21:04:19 -0800
commit0206e04e0a3542b8f0fc97996f1d885f7604a6fa (patch)
tree575f1388978b110064993445b73dcf268218a750 /OnekoNet.cs
parentc4dd5d6fe58a21f9cab5ce271cd3554c2fe791e3 (diff)
network mouse click, restructure oneko, add framework for NPCState stuff
Diffstat (limited to 'OnekoNet.cs')
-rw-r--r--OnekoNet.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/OnekoNet.cs b/OnekoNet.cs
index 27d6187..a5b2008 100644
--- a/OnekoNet.cs
+++ b/OnekoNet.cs
@@ -10,6 +10,8 @@ class OnekoNet : Oneko
public static Dictionary<int, OnekoNet> NetNekos = [];
+ float NetworkIssueTimer = 0f;
+
public OnekoNet(Bitmap bitmap, User user) : base(bitmap)
{
MyUser = user;
@@ -22,12 +24,23 @@ class OnekoNet : Oneko
Client.PacketRecived += (reader, user, packetType) => {
if (user != MyUser) return;
- if (packetType == PacketType.OnekoTargetPosition) TargetPosition = reader.GetVector2();
+ if (packetType == PacketType.OnekoState) {
+ Position = reader.GetVector2();
+ FrameId = reader.GetByte();
+ NetworkIssueTimer = 0f;
+ }
};
Client.ServerDisconnected += Dispose;
}
+ public override void Update(float delta)
+ {
+ NetworkIssueTimer += delta;
+ if (NetworkIssueTimer < 0.6f) ColorTint = Color.WHITE;
+ else ColorTint = Color.WHITE with {A = 120};
+ }
+
public static void SpawnNetNeko(User user)
{
if (!NetNekos.ContainsKey(user.Id)) {