Exemplo n.º 1
0
    /// <summary>
    /// OnMouseDown is called when the user has pressed the mouse button while
    /// over the GUIElement or Collider.
    /// </summary>
    protected void OnMouseDown()
    {
        Animator animator = gameObject.GetComponent <Animator>();

        if (animator != null)
        {
            gameObject.GetComponent <Animator>().runtimeAnimatorController = null;
        }
        renderer.sprite = gameBackground;
        currState       = AdState.Clicked;
        gameObject.GetComponent <Renderer>().sortingLayerName = "GameElement";
        gameObject.GetComponent <Renderer>().sortingOrder     = 2;
        if (topMostGame != null)
        {
            topMostGame.GetComponent <Renderer>().sortingOrder = 0;
            topMostGame.UpdateSortingOrder();
            topMostGame.GetComponent <BoxCollider2D>().enabled = true;
        }
        topMostGame = this;
        gameObject.GetComponent <BoxCollider2D>().enabled = false;
    }