示例#1
0
    void Map <T>(string address, Action <T> method, OscMessageType type)
    {
        // Validate.
        if (!ValidateAddressForMapping(address) || method == null || !ValidateMethodTarget(method.Target, address))
        {
            return;
        }

        // Get or create mapping.
        OscMapping mapping = null;

        GetOrCreateMapping(address, type, out mapping);

        // Add listener.
        mapping.Map(method.Target, method.Method);

        // Set dirty flag.
        _dirtyMappings = true;
    }
示例#2
0
    /// <summary>
    /// Request that 'method' is invoked when a message with matching 'address' is received with type tag Impulse (i), Null (N) or simply without arguments.
    /// </summary>
    public void MapImpulseNullOrEmpty(string address, UnityAction method)
    {
        // Validate.
        if (!ValidateAddressForMapping(address) || method == null || !ValidateMethodTarget(method.Target, address))
        {
            return;
        }

        // Get or create mapping.
        OscMapping mapping = null;

        GetOrCreateMapping(address, OscMessageType.ImpulseNullEmpty, out mapping);

        // Add listener.
        mapping.Map(method.Target, method.Method);

        // Set dirty flag.
        _dirtyMappings = true;
    }