Ejemplo n.º 1
0
    // Update is called once per frame
    // If the parent doesn't have local player authority, return immediately.
    void Update()
    {
        if (matchResultAnimation > 0.0f)
        {
            if (Input.GetMouseButtonUp(0))
            {
                matchResultAnimation = 0.0f;
            }
            matchResultAnimation -= Time.deltaTime;
            if (matchResultAnimation <= 0.0f)
            {
                CreateResultScreen();
            }
        }

        if (isSpectating)
        {
            if (spectatingAfterEndTimer > 0.0f)
            {
                spectatingAfterEndTimer -= Time.deltaTime;
                if (spectatingAfterEndTimer <= 0.0f)
                {
                    EndMatchPanel panel = GameObject.Instantiate <EndMatchPanel>(endMatchPanelPrefab);
                    panel.transform.SetParent(this.transform, false);
                    panel.SetText("Return to lobby?");
                    panel.OnReturnButtonClick += ExitObserveMatch;
                    isSpectating = false;
                }
            }
            else if (northHand.player.hasSelectedCardForMatch && southHand.player.hasSelectedCardForMatch)
            {
                northHand.SetAndRevealCard(northHand.player.CardAt(northHand.player.selectedCard));
                southHand.SetAndRevealCard(southHand.player.CardAt(southHand.player.selectedCard));
                spectatingAfterEndTimer = REVEAL_ANIMATION_LEGNTH;
            }
        }
    }