public static IInteractionType CreateInteractionTypeSpecialised(InteractionTypeEnum interactionType)
        {
            IInteractionType rc = null;

            switch (interactionType)
            {
            case InteractionTypeEnum.ConsoleUser:
                rc = new UserConsoleInteraction();
                break;

            default:
                rc = new BaseInteraction();
                break;
            }

            return(rc);
        }
 public EnvironmentalInteraction(string Name, string Description, int Difficulty, InteractionTypeEnum Type)
 {
     this.Name        = Name;
     this.Description = Description;
     this.Difficulty  = Difficulty;
     this.Type        = Type;
 }
Exemple #3
0
        public void SubscribeToEvent(InteractionTypeEnum interactionType, ref object eventType)
        {
            //check if already subscribed to
            int interactionEvtsCount;

            for (interactionEvtsCount = 0; interactionEvtsCount < m_interactionTypes.Count; interactionEvtsCount++)
            {
                if (interactionType == (InteractionTypeEnum)m_interactionTypes[interactionEvtsCount])
                {
                    return;
                }
            }

            //if not already subsribed to then, subscribe
            m_interactionTypes.Add(interactionType);

            switch (interactionType)
            {
            case InteractionTypeEnum.kSelection:

                //set a reference to the select events
                m_selectEvents = m_interactionEvents.SelectEvents;

                //connect the select event sink
                m_selectEvents.OnPreSelect          += m_Select_OnPreSelect_Delegate;
                m_selectEvents.OnPreSelectMouseMove += m_Select_OnPreSelectMouseMove_Delegate;
                m_selectEvents.OnStopPreSelect      += m_Select_OnStopPreSelect_Delegate;
                m_selectEvents.OnSelect             += m_Select_OnSelect_Delegate;
                m_selectEvents.OnUnSelect           += m_Select_OnUnSelect_Delegate;

                //specify burn through
                m_selectEvents.PreSelectBurnThrough = true;

                eventType = m_selectEvents;
                break;

            case InteractionTypeEnum.kMouse:

                //set a reference to the mouse events
                m_mouseEvents = m_interactionEvents.MouseEvents;

                //connect the mouse event sink
                m_mouseEvents.OnMouseUp          += m_Mouse_OnMouseUp_Delegate;
                m_mouseEvents.OnMouseDown        += m_Mouse_OnMouseDown_Delegate;
                m_mouseEvents.OnMouseClick       += m_Mouse_OnMouseClick_Delegate;
                m_mouseEvents.OnMouseDoubleClick += m_Mouse_OnMouseDoubleClick_Delegate;
                m_mouseEvents.OnMouseMove        += m_Mouse_OnMouseMove_Delegate;
                m_mouseEvents.OnMouseLeave       += m_Mouse_OnMouseLeave_Delegate;

                eventType = m_mouseEvents;
                break;

            case InteractionTypeEnum.kTriad:

                //set a reference to the triad events
                m_triadEvents = m_interactionEvents.TriadEvents;

                //connect the triad event sink
                m_triadEvents.OnActivate               += m_Triad_OnActivate_Delegate;
                m_triadEvents.OnEndMove                += m_Triad_OnEndMove_Delegate;
                m_triadEvents.OnEndSequence            += m_Triad_OnEndSequence_Delegate;
                m_triadEvents.OnMove                   += m_Triad_OnMove_Delegate;
                m_triadEvents.OnMoveTriadOnlyToggle    += m_Triad_OnMoveTriadOnlyToggle_Delegate;
                m_triadEvents.OnSegmentSelectionChange += m_Triad_OnSegmentSelectionChange_Delegate;
                m_triadEvents.OnStartMove              += m_Triad_OnStartMove_Delegate;
                m_triadEvents.OnStartSequence          += m_Triad_OnStartSequence_Delegate;
                m_triadEvents.OnTerminate              += m_Triad_OnTerminate_Delegate;

                eventType = m_triadEvents;
                break;
            }
        }