예제 #1
0
    void opponentAttack(float damage)
    {
        AttackBall opponentAttackBall = Instantiate(opponentAttackBallPrefab, opponentAttackBallSpawnPosition, Quaternion.identity).GetComponent <AttackBall> ();

        opponentAttackBall.transform.Rotate(new Vector3(0f, 180f));
        opponentAttackBall.setDamage(damage);
        opponentAttackBall.setOwn(false);
        opponentCharacterAnimator.SetTrigger(AnimationCommand.ATTACK);
    }
예제 #2
0
    public void judgeAnswer()
    {
        if (int.Parse(answerText.text) == problemSet.Value)
        {
            generateNewProblem();

            ownCharacterAnimator.SetTrigger(AnimationCommand.ATTACK);

            // Play sound effects
            tappingSound.PlayOneShot(GameSFX.ANSWER_CORRECT);

            // Add combo
            ++combo;
            comboText.text = "" + combo;
            comboTimer     = ownCharacter.getComboTimer();

            // Increase own special gauge
            ownSpecialGauge += ownCharacter.getSpecialBarIncrease() [difficulty];
            if (ownSpecialGauge >= 1)
            {
                ownSpecialGauge = 1;
                if (!specialButton.activeSelf)
                {
                    sound.PlayOneShot(GameSFX.SPECIAL_FULL);
                }
                specialButton.SetActive(true);
            }

            float      damage        = ownCharacter.getDamage() [difficulty] * (1 + combo * COMBO_MULTIPLIER);
            AttackBall ownAttackBall = Instantiate(ownAttackBallPrefab, opponentAttackBallSpawnPosition, Quaternion.identity).GetComponent <AttackBall> ();
            ownAttackBall.setDamage(damage);
            ownAttackBall.setOwn(true);

            // Call RPC
            this.photonView.RPC("opponentAttack", PhotonTargets.Others, damage);
            this.photonView.RPC("modifyOpponentSpecialGauge", PhotonTargets.Others, ownSpecialGauge);
        }
        else
        {
            resetCombo();

            // Play sound effects
            tappingSound.PlayOneShot(GameSFX.ANSWER_FALSE);
        }
        deleteAnswer();
    }
예제 #3
0
    void npcAttack()
    {
        opponentCharacterAnimator.SetTrigger(AnimationCommand.ATTACK);
        ++npcComboCount;

        int npcDifficulty = Random.Range(0, 3);

        //Set npc attack time
        switch (npcDifficulty)
        {
        case 0:
            npcAttackTime = Random.Range(1, 4);
            break;

        case 1:
            npcAttackTime = Random.Range(2, opponentCharacter.getComboTimer() + 1);
            break;

        case 2:
            npcAttackTime = Random.Range(3, opponentCharacter.getComboTimer() + 2);
            break;
        }
        ;

        npcComboTimer = opponentCharacter.getComboTimer();

        // Increase opponent's special gauge
        opponentSpecialGauge += opponentCharacter.getSpecialBarIncrease() [npcDifficulty];
        if (opponentSpecialGauge >= 1)
        {
            opponentSpecialGauge = 1;
        }

        float      damage             = opponentCharacter.getDamage() [npcDifficulty] * (1 + npcComboCount * COMBO_MULTIPLIER);
        AttackBall opponentAttackBall = Instantiate(opponentAttackBallPrefab, opponentAttackBallSpawnPosition, Quaternion.identity).GetComponent <AttackBall> ();

        opponentAttackBall.transform.Rotate(new Vector3(0f, 180f));
        opponentAttackBall.setDamage(damage);
        opponentAttackBall.setOwn(false);
    }