Ejemplo n.º 1
0
    public void ShowEnemyPutCard(CardName name)
    {
        Vector3 interval      = new Vector3(0.3f, 0, -0.4f);
        Vector3 startPosition = new Vector3(-4f, 0f, 0);

        int i = cardTombs.transform.childCount;

        if (i == 6)
        {
            ObjectPool.GetInstance().RecycleObj("motherPutCard", cardTombs.transform.GetChild(0).gameObject);


            for (int j = 0; j < cardTombs.transform.childCount; j++)
            {
                cardTombs.transform.GetChild(j).position -= interval;
            }
        }

        for (int j = 0; j < enemyCards.transform.childCount; j++)
        {
            if (enemyCards.transform.GetChild(j).name == name.ToString())
            {
                GameObject itemGo = Instantiate(backCard, enemyCards.transform.GetChild(j).position, Quaternion.identity);
                itemGo.name = name.ToString();
                itemGo.GetComponent <ViewEnemyCard>().StartFront(j);
                break;
            }
        }
    }
Ejemplo n.º 2
0
    public void ShowEnemyPutCard(CardName name)
    {
        Vector3 interval = new Vector3(0.3f, 0, -0.5f);

        if (cardTombs.transform.childCount == 6)
        {
            Destroy(cardTombs.transform.GetChild(0).gameObject);

            for (int j = 0; j < cardTombs.transform.childCount; j++)
            {
                cardTombs.transform.GetChild(j).position -= interval;
            }
        }

        for (int j = 0; j < enemyCards.transform.childCount; j++)
        {
            if (enemyCards.transform.GetChild(j).name == name.ToString())
            {
                GameObject itemGo = Instantiate(GameResources.cardBack, enemyCards.transform.GetChild(j).position, Quaternion.identity);
                itemGo.name = name.ToString();
                itemGo.GetComponent <ViewCardBack>().StartFront(j);
                break;
            }
        }
    }
Ejemplo n.º 3
0
    public static Card NewCard(CardName cardName)
    {
        //使用反射创建对象
        Type   type = Type.GetType(cardName.ToString());
        object obj  = Activator.CreateInstance(type, true);

        if (obj == null)
        {
            Debug.Log("No Card for" + cardName.ToString());
            return(null);
        }
        return((Card)obj);
    }
Ejemplo n.º 4
0
    public static void AddCard(List <Card> cards, CardName cardName, int num)
    {
        //使用反射创建对象
        Type   type = Type.GetType(cardName.ToString());
        object obj  = Activator.CreateInstance(type, true);

        if (obj == null)
        {
            Debug.Log("No Card for" + cardName.ToString());
        }

        for (int i = 0; i < num; i++)
        {
            cards.Add((Card)obj);
        }
    }
Ejemplo n.º 5
0
        public void CardNameToStringTest()
        {
            // Arrange
            CardName cardName = new CardName();
            // Act
            string result = cardName.ToString();

            // Assert
            Assert.IsTrue(result.Contains("english"));
        }
Ejemplo n.º 6
0
 public override string ToString()
 {
     return(CardName.ToString());
 }
Ejemplo n.º 7
0
 private static FieldInfo GetFieldInfo(CardName value)
 {
     return(value.GetType().GetField(value.ToString()));
 }
Ejemplo n.º 8
0
 public string GetCardName()
 {
     return(CurrentCardName.ToString());
 }