예제 #1
0
    // Loads the specified trap into a TrapCard.
    void SpawnTrapCard(Vector3 pos, GameObject trap)
    {
        TrapCard _trapCard = Instantiate(TrapCard, pos, transform.rotation, transform).GetComponent <TrapCard>();

        _trapCard.LoadTrapInSlot(trap);
        AssignThrowableTrap(_trapCard);

        // Checks if the player has equipped this trap already. If so, it sets this card to the respective trapRadial spot.
        for (int i = 0; i < trapSlots.Length; i++)
        {
            int trapIndex = trapSlots[i].representWhichSpot;
            if (player.currEquippedTraps[trapIndex] != null && player.currEquippedTraps[trapIndex].name == _trapCard.associatedTrap.name)
            {
                _trapCard.equipped = true;
                trapSlots[i].associatedTrapCard = _trapCard;
                break;
            }
        }
    }
예제 #2
0
    // Loads the specified trap into a TrapCard.
    void SpawnTrapCard(Vector3 pos, GameObject trap)
    {
        GameObject _trapCard    = (GameObject)Instantiate(TrapCard, pos, transform.rotation, Slider);
        TrapCard   thisTrapCard = _trapCard.GetComponent <TrapCard>();

        thisTrapCard.LoadTrapInSlot(trap);
        TrapCards.Add(thisTrapCard);
        thisTrapCard.trapCardSpawner   = this;
        thisTrapCard.CenterPoint       = Center;
        thisTrapCard.trapCanvas        = trapCanvasScript;
        thisTrapCard.confirmationGroup = confirmationGroup;

        // Checks if the player has equipped this trap already. If so, it sets this card to the respective trapRadial spot.
        for (int i = 0; i < trapSlots.Length; i++)
        {
            int trapIndex = trapSlots[i].representWhichSpot;
            if (player.currEquippedTraps[trapIndex] != null && player.currEquippedTraps[trapIndex].name == thisTrapCard.associatedTrap.name)
            {
                thisTrapCard.equipped           = true;
                trapSlots[i].associatedTrapCard = thisTrapCard;
                break;
            }
        }
    }