예제 #1
0
    protected void RaiseEvent(T gesture)
    {
        if (OnGesture != null)
        {
            OnGesture(gesture);
        }

        FingerGestures.FireEvent(gesture);

        if (UseSendMessage && !string.IsNullOrEmpty(EventMessageName))
        {
            if (EventMessageTarget)
            {
                EventMessageTarget.SendMessage(EventMessageName, gesture, SendMessageOptions.DontRequireReceiver);
            }

            if (SendMessageToSelection != SelectionType.None)
            {
                GameObject sel = null;

                switch (SendMessageToSelection)
                {
                case SelectionType.Default:
                    sel = GetDefaultSelectionForSendMessage(gesture);
                    break;

                case SelectionType.CurrentSelection:
                    sel = gesture.Selection;
                    break;

                case SelectionType.StartSelection:
                    sel = gesture.StartSelection;
                    break;
                }

                if (sel && sel != EventMessageTarget)
                {
                    sel.SendMessage(EventMessageName, gesture, SendMessageOptions.DontRequireReceiver);
                }
            }
        }
    }