Пример #1
0
    private GameObject InstantiatePlayerHandCardPrefab(Vector3 position, Quaternion rotation, int sortingOrder)
    {
        GameObject         playerHandCard = Instantiate(this.playerHandCardPrefab, position, rotation);
        GameObject         miniCard       = playerHandCard.transform.GetChild(1).gameObject;
        PlayerHandMiniCard miniCardScript = miniCard.GetComponent <PlayerHandMiniCard>();

        miniCard.GetComponent <Renderer>().sortingOrder = sortingOrder;
        miniCardScript.gameManager = this;

        GameObject         fullCard       = playerHandCard.transform.GetChild(0).gameObject;
        PlayerHandFullCard fullCardScript = fullCard.GetComponent <PlayerHandFullCard>();

        fullCardScript.gameManager = this;

        return(playerHandCard);
    }
Пример #2
0
    public void OnDropOverCard(PlayerHandFullCard fullCard, Vector2 dropPosition)
    {
        int dropRow = this.GetRowPositionFromDropPosition(dropPosition);

        // Remove existing placeHolder
        this.boardUnits.Remove(this.tempDropOverCard);
        Debug.Log("Removing existing placeholder, count=: " + this.boardUnits.Count);

        if (dropRow > 0)
        {
            this.AddDropOverPlaceHolderAtPosition(dropPosition, dropRow == 1 /* isFrontRow */);
        }

        // Move units accordingly
        this.RerenderPlayerRows();
    }
Пример #3
0
    public void OnDropCard(PlayerHandFullCard fullCard, Vector2 dropPosition)
    {
        this.boardUnits.Remove(this.tempDropOverCard);
        int dropRow = this.GetRowPositionFromDropPosition(dropPosition);

        if (dropRow == 0)
        {
            // Return card to hand if not dropped on board
            fullCard.HideFullCardShowMiniCard();
        }
        else
        {
            // Replace placeholder with real unit when rendering
            PlaceholderBoardUnit placeHolderUnit = this.AddDropOverPlaceHolderAtPosition(dropPosition, dropRow == 1);
            placeHolderUnit.ShouldReplaceWithRealUnit = true;

            // Remove card from hand
            fullCard.RemovePlayerHandCard();
        }

        // Move units accordingly
        this.RerenderPlayerRows();
    }