Пример #1
0
    void Awake()
    {
        gameManagerScript = gameManager.GetComponent <GameManager>();
        boardManagerA     = boardA.GetComponent <BoardManager>();
        boardManagerB     = boardB.GetComponent <BoardManager>();
        cursorAScript     = playerACursor.GetComponent <ManyCursorController>();
        cursorBScript     = playerBCursor.GetComponent <ManyCursorController>();

        playerACursorPos = playerACursor.transform.position;
        playerBCursorPos = playerBCursor.transform.position;

        running = false;
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        if (highlightRenderer != null)
        {
            // Activa el highlight en caso de que el cursor entre en contacto con el fruto.
            if (other.tag == "CursorA" || other.tag == "CursorB")
            {
                ManyCursorController cursor = other.gameObject.GetComponent <ManyCursorController>();
                if (!cursor.isSelecting)
                {
                    highlight.SetActive(true);
                }

                selector = other.tag;
            }

            // En caso de que entre en contacto con un cofre, activa el highlight verde.
            if (other.tag == "Chest")
            {
                highlightRenderer.color = green;
                inChest = true;
            }
        }
    }