示例#1
0
    // add new card GameObject to hand
    public void MoveDrawnCardFromDeckToHand(Card cardDrawn, PlayerModel player, GameObject deckVisual)
    {
        // ----------instantiate drawn card given as parameter and load its display in player's hand
        this.isDrawingRunning = true;
        GameObject newCard;

        if (cardDrawn.maxHealth > 0)
        {
            newCard = Instantiate(GameManager.Instance.unitCard, deckVisual.transform.position, Quaternion.Euler(0, 180, 0), GameManager.Instance.visuals.transform);
        }
        else
        {
            newCard = Instantiate(GameManager.Instance.tacticsCard, deckVisual.transform.position, Quaternion.Euler(0, 180, 0), GameManager.Instance.visuals.transform);
        }

        IDAssignment idAssignment = newCard.GetComponent(typeof(IDAssignment)) as IDAssignment;


        if (idAssignment != null)
        {
            idAssignment.uniqueId      = cardDrawn.cardID;
            idAssignment.ownerPosition = handPosition;
            idAssignment.whereIsCard   = WhereIsCard.Hand;
        }

        CardDisplayLoader cardDisplayLoader = newCard.GetComponent <CardDisplayLoader>();

        cardDisplayLoader.card = cardDrawn;
        cardDisplayLoader.loadCardAsset();
        StartCoroutine(rotateWhenDrawn(newCard, player));
    }
 private void OnEnable()
 {
     if (entity == null)
     {
         entity = new Entity(IDAssignment.GetID(typeof(Entity).FullName));
         id     = entity.id;
     }
 }