Пример #1
0
    private static void FindLoot(WorldController wc)
    {
        CardDescriptions temp = CardDescriptions.RandomCard();

        wc.p.H.AddCard(Card.CreateCard(temp));
        wc.displayMessage.Display("You found a " + temp.name + "!", wc.canvas, wc.aControl.item);
    }
Пример #2
0
    public static Card CreateCard(CardDescriptions c)
    {
        GameObject newGO   = GameObject.Instantiate(Resources.Load("Prefabs/Cards/GenericCard"), new Vector3(), Quaternion.identity) as GameObject;
        Card       newCard = newGO.GetComponent <Card> ();

        newCard.InitCard(c.weight, c.attack, c.value, c.uses, c.capacity, c.teleport, c.type, c.name, c.action);
        //Card newCard = new Card (c.Weight, c.Attack, c.Value, c.Uses, c.Type, c.Name, c.ActionEnum);
        //newCard.GO = GameObject.Instantiate (Resources.Load ("Prefabs/Cards/GenericCard"), new Vector3 (), Quaternion.identity) as GameObject;

        return(newCard);
    }
Пример #3
0
 public void OnDeath(WorldController wc)
 {
     if (Random.Range(0, 100) < (int)loot)
     {
         CardDescriptions temp = CardDescriptions.RandomCard();
         wc.p.H.AddCard(Card.CreateCard(temp));
         wc.p.H.DisableCards();
         wc.displayMessage.Display("The " + this.Name + " dropped a " + temp.name + "!", wc.canvas, wc.aControl.item);
     }
     else
     {
         wc.displayMessage.Display("The " + this.name + " dropped nothing...", wc.canvas);
     }
 }
Пример #4
0
    public static CardDescriptions RandomCard()
    {
        CardDescriptions cd = null;

        while (true)
        {
            if (Random.Range(0, 100) < (int)CardDrop.Weapon)
            {
                while (true)
                {
                    cd = CardDescriptions.GetDescription((CardName)UnityEngine.Random.Range(0, GlobalConstants.numCards));
                    if (cd.type == CardType.Weapon)
                    {
                        return(cd);
                    }
                }
            }
            if (Random.Range(0, 100) < (int)CardDrop.Utility)
            {
                while (true)
                {
                    cd = CardDescriptions.GetDescription((CardName)UnityEngine.Random.Range(0, GlobalConstants.numCards));
                    if (cd.type == CardType.Utility)
                    {
                        return(cd);
                    }
                }
            }
            if (Random.Range(0, 100) < (int)CardDrop.Spell)
            {
                while (true)
                {
                    cd = CardDescriptions.GetDescription((CardName)UnityEngine.Random.Range(0, GlobalConstants.numCards));
                    if (cd.type == CardType.Spell)
                    {
                        return(cd);
                    }
                }
            }
            if (Random.Range(0, 100) < (int)CardDrop.Treasure)
            {
                while (true)
                {
                    cd = CardDescriptions.GetDescription((CardName)UnityEngine.Random.Range(0, GlobalConstants.numCards));
                    if (cd.type == CardType.Treasure)
                    {
                        return(cd);
                    }
                }
            }
            if (Random.Range(0, 100) < (int)CardDrop.Junk)
            {
                while (true)
                {
                    cd = CardDescriptions.GetDescription((CardName)UnityEngine.Random.Range(0, GlobalConstants.numCards));
                    if (cd.type == CardType.Junk)
                    {
                        return(cd);
                    }
                }
            }
        }
    }