From 3564eb2adc2a8964101ad1f5cb1e1238b72fc089 Mon Sep 17 00:00:00 2001 From: Edmand46 Date: Sun, 13 Nov 2022 18:53:56 +0400 Subject: [PATCH] feat: added except invoker target --- Ragon.Common/Sources/RagonTarget.cs | 1 + Ragon/Sources/Entity/Entity.cs | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Ragon.Common/Sources/RagonTarget.cs b/Ragon.Common/Sources/RagonTarget.cs index ced8277..f20bfa2 100644 --- a/Ragon.Common/Sources/RagonTarget.cs +++ b/Ragon.Common/Sources/RagonTarget.cs @@ -4,6 +4,7 @@ namespace Ragon.Common { Owner, ExceptOwner, + ExceptInvoker, All, } } \ No newline at end of file diff --git a/Ragon/Sources/Entity/Entity.cs b/Ragon/Sources/Entity/Entity.cs index dfaf777..b3412fd 100644 --- a/Ragon/Sources/Entity/Entity.cs +++ b/Ragon/Sources/Entity/Entity.cs @@ -81,7 +81,7 @@ public class Entity serializer.WriteData(ref payload); var sendData = serializer.ToArray(); - Send(targetMode, sendData); + RouteEvent(peerId, targetMode, sendData); } public void ReadState(uint peerId, RagonSerializer serializer) @@ -208,7 +208,7 @@ public class Entity _room.BroadcastToReady(sendData, DeliveryType.Reliable); } - void Send(RagonTarget targetMode, byte[] sendData) + void RouteEvent(ushort peerId, RagonTarget targetMode, byte[] sendData) { switch (targetMode) { @@ -222,6 +222,11 @@ public class Entity _room.BroadcastToReady(sendData, new [] { OwnerId }, DeliveryType.Reliable); break; } + case RagonTarget.ExceptInvoker: + { + _room.BroadcastToReady(sendData, new[] {peerId}, DeliveryType.Reliable); + break; + } case RagonTarget.All: { _room.BroadcastToReady(sendData, DeliveryType.Reliable);