Beispiel #1
0
    private void Awake()
    {
        Debug.Log(TBL_MOVE_CARD.CountEntities); // 3
        int count = TBL_MOVE_CARD.CountEntities;

        for (int i = 0; i < count; ++i)
        {
            TBL_MOVE_CARD data = TBL_MOVE_CARD.GetEntity(i);
            Debug.Log(data.Name);
            Debug.Log(data.Distance);
            Debug.Log(data.Comment);
        }

        TBL_MOVE_CARD.ForEachEntity((data) =>
        {
            Debug.Log(data.Name);
            Debug.Log(data.Distance);
            Debug.Log(data.Comment);
        });


        var data3st = TBL_MOVE_CARD.GetEntity(3);

        if (data3st == null)
        {
            Debug.LogError("3번째 데이터 NUll");
        }
    }
Beispiel #2
0
    private Card RandomMoveCard()
    {
        int         value = Random.Range(0, 100);
        Card        card  = null;
        List <Temp> list  = new List <Temp>();

        for (int i = 0; i < TBL_MOVE_CARD.CountEntities; i++)
        {
            TBL_MOVE_CARD data = TBL_MOVE_CARD.GetEntity(i);
            MoveCard      c    = new MoveCard(data);
            list.Add(new Temp(c.percent, CardType.EnergyCard, c));
        }

        float cumulative = 0f;

        for (int i = 0; i < list.Count; i++)
        {
            cumulative += list[i].percent;
            if (value <= cumulative)
            {
                card = list[i].card;
                break;
            }
        }
        return(card);
    }
Beispiel #3
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            Player.UseMoveCard(new MoveCard(TBL_MOVE_CARD.GetEntity(0)));
        }
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            Player.UseMoveCard(new MoveCard(TBL_MOVE_CARD.GetEntity(1)));
        }
        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            Player.UseMoveCard(new MoveCard(TBL_MOVE_CARD.GetEntity(2)));
        }
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            Player.UseMoveCard(new MoveCard(TBL_MOVE_CARD.GetEntity(3)));
        }

        //적 플레이어 디버그
        if (Input.GetKeyDown(KeyCode.A))
        {
            Enemy.UseMoveCard(new MoveCard(TBL_MOVE_CARD.GetEntity(0)));
        }
        if (Input.GetKeyDown(KeyCode.D))
        {
            Enemy.UseMoveCard(new MoveCard(TBL_MOVE_CARD.GetEntity(1)));
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            Enemy.UseMoveCard(new MoveCard(TBL_MOVE_CARD.GetEntity(2)));
        }
        if (Input.GetKeyDown(KeyCode.W))
        {
            Enemy.UseMoveCard(new MoveCard(TBL_MOVE_CARD.GetEntity(3)));
        }
    }
Beispiel #4
0
    void SetCard()
    {
        int startCount = CardSetting.AttackCardStartCount;

        while (startCount > 0)
        {
            int        random = Random.Range(0, TBL_ATTACK_CARD.CountEntities);
            AttackCard card   = new AttackCard(TBL_ATTACK_CARD.GetEntity(random));
            if (!CheckDuplicate(card))
            {
                cardList.Add(card);
                startCount--;
            }
        }

        startCount = CardSetting.EnergyCardStartCount;
        while (startCount > 0)
        {
            int        random = Random.Range(0, TBL_ENERGY_CARD.CountEntities);
            EnergyCard card   = new EnergyCard(TBL_ENERGY_CARD.GetEntity(random));
            if (!CheckDuplicate(card))
            {
                cardList.Add(card);
                startCount--;
            }
        }

        startCount = CardSetting.GuardCardStartCount;
        while (startCount > 0)
        {
            int       random = Random.Range(0, TBL_GUARD_CARD.CountEntities);
            GuardCard card   = new GuardCard(TBL_GUARD_CARD.GetEntity(random));
            if (!CheckDuplicate(card))
            {
                cardList.Add(card);
                startCount--;
            }
        }

        startCount = CardSetting.HealCardStartCount;
        while (startCount > 0)
        {
            int      random = Random.Range(0, TBL_HEAL_CARD.CountEntities);
            HealCard card   = new HealCard(TBL_HEAL_CARD.GetEntity(random));
            if (!CheckDuplicate(card))
            {
                cardList.Add(card);
                startCount--;
            }
        }

        startCount = CardSetting.MoveCardStartCount;
        while (startCount > 0)
        {
            int      random = Random.Range(0, TBL_MOVE_CARD.CountEntities);
            MoveCard card   = new MoveCard(TBL_MOVE_CARD.GetEntity(random));
            if (!CheckDuplicate(card))
            {
                cardList.Add(card);
                startCount--;
            }
        }



        Shuffle(cardList);

        //for(int i=0; i<list.Count; i++)
        //{
        //    cardPos[i].GetComponent<CardComponent>().SetCard(list[i]);
        //}

        UpdateCardPos();
    }