Ejemplo n.º 1
0
    IEnumerator Battle(int damageCal)
    {
        GamePlayerManager attacker;
        GamePlayerManager defender;

        if (isMyTurn)
        {
            attacker = player[0];
            defender = player[1];
        }
        else
        {
            attacker = player[1];
            defender = player[0];
        }



        //食べたメッセージ
        messageController.messagePanel.SetActive(true);
        messageController.EatMessage(eatCardController.model, isMyTurn);



        //料理
        if (eatCardController.model.kind == KIND.DISH)
        {
            //2枚使ったら2枚引く
            if (isMyTurn)
            {
                drawNum = 2;
            }

            attacker.cost -= mixCost;

            StartCoroutine(uiManager.ShowCost(isMyTurn));

            yield return(new WaitForSeconds(2));

            int cardID   = eatCardController.model.cardID;
            int strength = eatCardController.model.strength;

            //テスト
            //cardID = 1;
            //strength = 0;

            //ランダム効果
            if (cardID == 0)
            {
                messageController.EffectMessage("ランダムで効果が発生する!");
                yield return(new WaitForSeconds(2));

                if (isMyTurn)
                {
                    cardID = UnityEngine.Random.Range(1, 27);
                    RandomEffect(cardID, strength, damageCal);
                }
            }
            else
            {
                //yield return new WaitForSeconds(2);
                StartCoroutine(specialController.DishEffect(cardID, strength, damageCal, isMyTurn));
                //StartCoroutine(specialController.DishEffect(6, strength, damageCal, isMyTurn));
            }
        }
        //素材
        else
        {
            yield return(new WaitForSeconds(2));

            //「あなたの攻撃」テキスト
            messageController.AttackText(isMyTurn);
            yield return(new WaitForSeconds(1));


            defender.hp -= eatCardController.model.cal;
            uiManager.ShowDamageText(damageCal, isMyTurn);
            yield return(new WaitForSeconds(2));



            attacker.cost += eatCardController.model.cost;
            if (attacker.cost > maxCost)
            {
                attacker.cost = maxCost;
            }

            //1枚使ったら1枚引く
            if (isMyTurn)
            {
                drawNum = 1;
            }

            messageController.messagePanel.SetActive(false);

            ChangeTurn();
        }



        //if (isMyTurn)
        //{
        //    uiManager.decideButtonObj.SetActive(false);
        //}
        //else
        //{
        //    uiManager.decideButtonObj.SetActive(true);
        //}
    }
Ejemplo n.º 2
0
    //料理の効果
    public IEnumerator DishEffect(int cardID, bool isStrong, int damageCal, bool isAttacker)
    {
        messageController.messagePanel.SetActive(true);
        messageController.ChangeMessageColor(isAttacker);


        this.isStrong   = isStrong;
        this.damageCal  = damageCal;
        this.isAttacker = isAttacker;


        effectMessage = null;


        if (isAttacker)
        {
            attacker     = player[0];
            defender     = player[1];
            attackerName = gameManager.playerName[0];
            defenderName = gameManager.playerName[1];
        }
        else
        {
            attacker     = player[1];
            defender     = player[0];
            attackerName = gameManager.playerName[1];
            defenderName = gameManager.playerName[0];
        }


        if (cardID == 0)
        {
            messageController.EatMessage(gameManager.eatCardController[attacker.playerIndex].model, isAttacker);
            yield return(new WaitForSeconds(2f));
        }


        //攻撃できなくても効果が出るもの
        switch (cardID)
        {
        case 0:
            RandomEffect();
            break;

        case 1:
            GamblingAttack();
            break;

        case 2:
            RandomDamage();
            break;

        case 3:
            EnemyCostBonus();
            break;

        case 4:
            MyConditionBonus();
            break;

        case 5:
            TurnCountBonus();
            break;

        case 6:
            ThrowEnemyRare();
            break;

        case 7:
            IncreaseMyRare();
            break;

        case 8:
            StealEnemyRare();
            break;

        case 9:
            HealHp();
            break;

        case 10:
            DamageHealHp();
            break;

        case 11:
            HealCondition();
            break;

        case 12:
            DishAttack();
            break;

        case 13:
            ConditionAttack();
            break;

        case 14:
            BadIngredientAttack();
            break;

        case 15:
            StealEnemyCost();
            break;

        case 16:
            IncreaseMyCost();
            break;

        case 17:
            ReduceEnemyCost();
            break;

        case 18:
            Clumsy();
            break;

        case 19:
            Dark();
            break;

        case 20:
            Poison();
            break;

        case 21:
            ReduceDamage();
            break;

        case 22:
            DamageCounter();
            break;

        case 23:
            InvalidateEffect();
            break;

        case 24:
            WeakenIngredient("赤食材");
            break;

        case 25:
            WeakenIngredient("黄食材");
            break;

        case 26:
            WeakenIngredient("緑食材");
            break;

        default:
            Debug.Log("料理範囲外");
            break;
        }



        if (effectMessage != null)
        {
            messageController.EffectMessage(effectMessage);
            effectMessage = null;
            yield return(new WaitForSeconds(2f));
        }


        //ランダム
        if (cardID == 0)
        {
            gameManager.eatCardController[attacker.playerIndex].model.cardID = randomCardID;
            randomCardID = -1;
            if (isAttacker || gameManager.single)
            {
                gameManager.DamageCalculation();
            }
        }
        else
        {
            gameManager.CheckStatus();
        }
    }