Exemplo n.º 1
0
        public static void AddOutgoingSignal(BaseScope scope, Type outgoingScopeType, NetworkReader reader)
        {
            // read useless data
            reader.ReadInt32();

            int signalType = reader.ReadInt32();

            MethodInfo method = outgoingScopeType.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public).FirstOrDefault(m => m.Name.GetHashCode() == signalType);

            if (method == null)
            {
                Debug.Log("Could not find method with sigType " + signalType);
            }

            ScopeEvents ev = GetOrCreateScopeEvent(scope);

            SignalEvent sigEvent = ev.AddSignalEvent(method, reader, false);

            reader.SeekZero();

            if (OnSignalEvent != null)
            {
                OnSignalEvent(scope, sigEvent);
            }
        }
Exemplo n.º 2
0
        public static void AddIncomingSignal(BaseScope scope, NetworkReader reader)
        {
            int signalType = reader.ReadInt32();

            MethodInfo method = scope.GetType().GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public).FirstOrDefault(m => m.Name.GetHashCode() == signalType);

            ScopeEvents ev = GetOrCreateScopeEvent(scope);

            SignalEvent sigEvent = ev.AddSignalEvent(method, reader, false);

            reader.SeekZero();

            if (OnSignalEvent != null)
            {
                OnSignalEvent(scope, sigEvent);
            }
        }