public override float DoStep(StepData inputStep, Dictionary <int, List <StepData> > dictionary = null)
    {
        if (behaviorType == BehaviorTypes.component && component != null)
        {
            switch (component.type.ToLower())
            {
            case "signal":
                if (inputStep.eventType == "E")
                {
                    int passed = component.configuration.passed;
                    if (inputStep.componentStatus != null)
                    {
                        if (inputStep.componentStatus.passed != null)
                        {
                            if (inputStep.componentStatus.passed >= 1)
                            {
                                passed = inputStep.componentStatus.passed - component.configuration.passed;
                                component.configuration.passed         = inputStep.componentStatus.passed;
                                GetComponent <SpriteRenderer>().sprite = GameManager.Instance.GetGridManager().GetSprite(component);
                                iTween.ScaleFrom(gameObject, iTween.Hash(
                                                     "scale", Vector3.one * 1.5f,
                                                     "time", 0.5f,
                                                     "oncomplete", "ResetSprite"
                                                     ));
                            }
                        }
                    }

                    GridObjectBehavior linkedObject = GameManager.Instance.GetGridManager().GetGridObjectByID(component.configuration.link);
                    if (linkedObject != null && linkedObject.component != null && linkedObject.component.type == "conditional")
                    {
                        for (int i = 0; i < passed; i++)
                        {
                            linkedObject.BeginInteraction();
                        }
                    }
                }
                break;
            }
        }
        return(0);
    }
    public void PlayerInteractionListener()
    {
        switch (interactionPhase)
        {
        case InteractionPhases.ingame_default:
            if (playerInteraction_UI.IsSubPanelOpen())
            {
                return;
            }

            /*
             * if player LEFT clicks during basic play, they can
             * (1) Click and drag movable elements
             */
            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                if (GameManager.Instance.GetGridManager().IsEditableElement(Input.mousePosition))
                {
                    currentGridObject = GameManager.Instance.GetGridManager().RetrieveEditableGridObject(Input.mousePosition);
                    currentGridObject.BeginDrag();
                    interactionPhase = InteractionPhases.ingame_dragging;
                    GameManager.Instance.tracker.CreateEventExt("BeginReposition", currentGridObject.component.type);

                    if (currentGridObject.component.type == "signal" && connectVisibilityLock)
                    {
                        Signal_GridObjectBehavior s = (Signal_GridObjectBehavior)currentGridObject;
                        s.SetHighlight(false);
                    }
                }
                if (hoverObject)
                {
                    if (!connectVisibility)
                    {
                        hoverObject.EndHoverBehavior();
                    }
                    hoverObject = null;
                }
            }

            /*
             * if player RIGHT clicks during basic play, they can:
             * (1) link connectable elements through Signals
             * (2) Open/Close Semaphores
             */
            else if (Input.GetKeyDown(KeyCode.Mouse1))
            {
                if (GameManager.Instance.GetGridManager().IsObjectOfType(Input.mousePosition, "signal") /*&& GameManager.Instance.GetGridManager().IsEditableElement( Input.mousePosition )*/)
                {
                    currentGridObject = GameManager.Instance.GetGridManager().RetrieveGridObjectOfType(Input.mousePosition, "signal");
                    currentGridObject.EnableGridObjectEventBehaviors(GridObjectBehavior.InteractTypes.rightClick);
                    interactionPhase = InteractionPhases.ingame_connecting;
                    currentGridObject.BeginInteraction();

                    List <GridObjectBehavior> otherSignals = GameManager.Instance.GetGridManager().GetGridComponentsOfType(new List <string>()
                    {
                        "signal"
                    });
                    foreach (GridObjectBehavior otherSignal in otherSignals)
                    {
                        if (currentGridObject != otherSignal)
                        {
                            otherSignal.GetComponent <SpriteRenderer>().sortingOrder = Constants.ComponentSortingOrder.connectionOverlay - 1;
                        }
                    }

                    GameManager.Instance.tracker.CreateEventExt("BeginLink", currentGridObject.component.type);

                    playerInteraction_UI.onHoverLightbox.OpenPanel();
                }
                else if (GameManager.Instance.GetGridManager().IsObjectOfType(Input.mousePosition, "semaphore") && GameManager.Instance.GetGridManager().IsEditableElement(Input.mousePosition))
                {
                    currentGridObject = GameManager.Instance.GetGridManager().RetrieveGridObjectOfType(Input.mousePosition, "semaphore");
                    currentGridObject.EnableGridObjectEventBehaviors(GridObjectBehavior.InteractTypes.rightClick);
                    currentGridObject.BeginInteraction();
                    GameManager.Instance.tracker.CreateEventExt("BeginLink", currentGridObject.component.type);
                }

                if (hoverObject /*&& !connectVisibilityLock*/)
                {
                    hoverObject.EndHoverBehavior();
                    hoverObject = null;
                }
            }

            /*
             * if a player isn't clicking the mouse, we should check for hover behaviors
             */
            else
            {
                if (Input.mousePosition == stationaryMousePosition)                         //if mouse is stationary
                {
                    if (hoverObject == null)
                    {
                        stationaryTime += Time.deltaTime;
                        if (stationaryTime >= 0.2f)
                        {
                            if (
                                GameManager.Instance.GetGridManager().IsObjectOfType(Input.mousePosition, "signal") ||
                                GameManager.Instance.GetGridManager().IsObjectOfType(Input.mousePosition, "diverter") ||
                                GameManager.Instance.GetGridManager().IsObjectOfType(Input.mousePosition, "exchange") ||
                                GameManager.Instance.GetGridManager().IsObjectOfType(Input.mousePosition, "delivery") ||
                                GameManager.Instance.GetGridManager().IsObjectOfType(Input.mousePosition, "pickup") ||
                                GameManager.Instance.GetGridManager().IsObjectOfType(Input.mousePosition, "conditional") ||
                                GameManager.Instance.GetGridManager().IsObjectOfType(Input.mousePosition, "semaphore")
                                )
                            {
                                hoverObject = GameManager.Instance.GetGridManager().GetGridObjectByMousePosition(Input.mousePosition);
                                hoverObject.OnHoverBehavior();
                                GameManager.Instance.tracker.CreateEventExt("OnHoverBehavior", hoverObject.component.type);
                            }
                        }
                    }
                }
                else                         //if mouse has moved since last frame
                {
                    stationaryMousePosition = Input.mousePosition;
                    if (hoverObject)
                    {
                        if (GameManager.Instance.GetGridManager().IsOccupied(Input.mousePosition))
                        {
                            if (hoverObject != GameManager.Instance.GetGridManager().GetGridObjectByMousePosition(Input.mousePosition))
                            {
                                EndHoverEvent();
                            }
                        }
                        else
                        {
                            EndHoverEvent();
                        }
                    }
                    else
                    {
                        stationaryTime = 0f;
                    }

                    //pop up tooltip close check
                    if (playerInteraction_UI.tooltipOverlay.tooltipActive && Time.time - playerInteraction_UI.tooltipOverlay.openTime > 0.5f)
                    {
                        playerInteraction_UI.tooltipOverlay.ClosePanel();
                    }
                }
                stationaryMousePosition = Input.mousePosition;
                GridObjectBehavior hoverObject__ = GameManager.Instance.GetGridManager().GetGridObjectByMousePosition(Input.mousePosition);
                if (hoverObject__ != null && hoverObject__ != hoverObject_)
                {
                    hoverObject_ = hoverObject__;
                    if (hoverObject_.component != null)
                    {
                        GameManager.Instance.tracker.CreateEventExt("OnMouseComponent", hoverObject_.component.type.ToString() + "/" + hoverObject_.component.id.ToString());
                    }
                }
                if (hoverObject__ == null && hoverObject_ != null)
                {
                    GameManager.Instance.tracker.CreateEventExt("OutMouseComponent", hoverObject_.component.type.ToString() + "/" + hoverObject_.component.id.ToString());
                    hoverObject_ = null;
                }
            }
            break;

        case InteractionPhases.ingame_dragging:
            if (Input.GetKey(KeyCode.Mouse0))
            {
                if (currentGridObject != null)
                {
                    currentGridObject.ContinueDrag();
                    if (trashHover)
                    {
                    }
                    else
                    {
                    }
                }
                else
                {
                    interactionPhase = InteractionPhases.ingame_default;
                }
            }
            else
            {
                if (trashHover)
                {
                    GameManager.Instance.GetGridManager().ForgetGridElement(currentGridObject);
                    if (currentGridObject.component.configuration.link != null && currentGridObject.component.configuration.link > 0)
                    {
                        //	GridObjectBehavior g = GameManager.Instance.GetGridManager().GetGridObjectByID( currentGridObject.component.configuration.link );
                        //	g.component.configuration.link = 0;
                    }
                    GameManager.Instance.tracker.CreateEventExt("Destroying", currentGridObject.component.type);
                    Destroy(currentGridObject.gameObject);
                    currentGridObject = null;
                    interactionPhase  = InteractionPhases.ingame_default;
                }
                else
                {
                    GameManager.Instance.tracker.CreateEventExt("EndReposition", currentGridObject.component.type);
                    currentGridObject.EndDrag();

                    if (currentGridObject.component.type == "signal" && connectVisibilityLock)
                    {
                        Signal_GridObjectBehavior s = (Signal_GridObjectBehavior)currentGridObject;
                        s.SetHighlight(true);
                    }

                    currentGridObject = null;
                    interactionPhase  = InteractionPhases.ingame_default;
                }
            }
            break;

        case InteractionPhases.ingame_connecting:

            if (Input.GetKeyDown(KeyCode.Mouse1))
            {
                currentGridObject.EndInteraction();
                if (GameManager.Instance.GetGridManager().IsObjectOfType(Input.mousePosition, "semaphore"))
                {
                    GridObjectBehavior g = GameManager.Instance.GetGridManager().GetGridObjectByMousePosition(Input.mousePosition);
                    currentGridObject.LinkTo(g);
                    GameManager.Instance.tracker.CreateEventExt("LinkTo", currentGridObject.component.type);
                }

                else if (GameManager.Instance.GetGridManager().IsObjectOfType(Input.mousePosition, "conditional"))
                {
                    GridObjectBehavior g = GameManager.Instance.GetGridManager().GetGridObjectByMousePosition(Input.mousePosition);
                    currentGridObject.LinkTo(g);
                    GameManager.Instance.tracker.CreateEventExt("LinkTo", currentGridObject.component.type);
                }

                playerInteraction_UI.onHoverLightbox.ClosePanel();

                List <GridObjectBehavior> otherSignals = GameManager.Instance.GetGridManager().GetGridComponentsOfType(new List <string>()
                {
                    "signal"
                });
                foreach (GridObjectBehavior otherSignal in otherSignals)
                {
                    if (currentGridObject != otherSignal)
                    {
                        otherSignal.GetComponent <SpriteRenderer>().sortingOrder = Constants.ComponentSortingOrder.connectionComponents;
                    }
                    if (connectVisibilityLock)
                    {
                        otherSignal.SetHighlight(true);
                    }
                }


                interactionPhase = InteractionPhases.ingame_default;
            }
            else
            {
                currentGridObject.ContinueInteraction();
            }
            break;

        case InteractionPhases.simulation:
            simulationTime += Time.deltaTime;
            break;
        }
    }