Exemplo n.º 1
0
    //Do this when the selectable UI object is selected.
    public void OnSelect(BaseEventData eventData)
    {
        if (audioSource != null)
        {
            audioSource.Play();
        }
        if (isThisTrap)
        {
            GetCurrentFirstTrap();
            if (Input.GetAxis("Horizontal_Menu") > 0 || IsSpellQueueNull())
            {
                if (cs != null)
                {
                    cs.DestroyTarget();
                }
                if (currentFirstTrap != null && currentFirstTrap.gameObject == this.gameObject)
                {
                    currentFirstTrap = null;
                    controllerCursor.transform.localPosition = new Vector3(0, 130);
                    cursorMove.MovingTraps = true;
                }
            }
            if (cursorMove != null)
            {
                cursorMove.MovingTraps = true;
            }
        }
        else
        {
            GetCurrentLastSpell();
            if (Input.GetAxis("Horizontal_Menu") < 0 || IsTrapQueueNull())
            {
                if (pt != null)
                {
                    pt.DestroyGhost();
                }
                if (currentLastSpell != null && currentLastSpell.gameObject == this.gameObject)
                {
                    controllerCursor.transform.localPosition = new Vector3(0, -130);
                    cursorMove.MovingTraps = false;
                }
            }
            if (cursorMove != null)
            {
                cursorMove.MovingTraps = false;
            }
        }

        //Button Scaling
        ScaleUp();

        GetComponent <Button>().onClick.Invoke();
    }