コード例 #1
0
ファイル: mainPlayer.cs プロジェクト: wolong91/MageDuel
    //protected override void comboAttack()
    //{
    //    if (isEndOfRangeAttack == false)//still doing range attack
    //        return;
    //    if (Input.GetKeyDown("o"))//melee attack
    //    {
    //        if(canCombo == false)
    //        {
    //            coolDownMeleeTimer[0] = coolDownMeleeAttackRate;
    //        }
    //        if (isMeleeComboCount[0] == false)//1st attack
    //        {
    //            meleeAttack();
    //            isMeleeComboCount[0] = true;
    //            myAnimator.SetBool("meleeAttack1", true);
    //            StartCoroutine(WaitForAnimation("melee 1", 0));
    //        }
    //        else
    //        {
    //            if (canCombo == true)
    //            {
    //                if (isMeleeComboCount[1] == false)//haven do 2nd combo
    //                {
    //                    if (coolDownMeleeTimer[0] > 0)//2nd attack combo
    //                    {
    //                        meleeAttack();
    //                        isMeleeComboCount[1] = true;
    //                        coolDownMeleeTimer[1] = coolDownMeleeAttackRate;
    //                        myAnimator.SetBool("meleeAttack2", true);
    //                    }
    //                }
    //                else
    //                {
    //                    if (isMeleeComboCount[2] == false)//haven do final combo
    //                    {
    //                        if (coolDownMeleeTimer[1] > 0)//final combo
    //                        {
    //                            meleeAttack();
    //                            isMeleeComboCount[2] = true;
    //                            myAnimator.SetBool("meleeAttack3", true);
    //                            myAnimator.SetTrigger("finishCombo");
    //                            //myAnimator.SetBool("finishCombo", true);
    //                            StartCoroutine(WaitForAnimation("melee 3", 0));
    //                        }
    //                    }
    //                }
    //            }
    //        }
    //    }
    //}
    public void checkShapeDraw(drawShape.shape myshape)
    {
        if (canRangeAttack == false)//prevent use of melee
            return;

        if (lastDrawShape == drawShape.shape.horizontal_line)
        {
            if (myshape == drawShape.shape.vertical_line)
            {
                if (isAttack == true)
                    return;

                //multiple attack
                rangeAttackAnimation();
                for (int i = 0; i < 3; i++)//3
                {
                    Vector3 newPos = new Vector3(enemy.transform.position.x,
                                                 enemy.transform.position.y, enemy.transform.position.z);
                    newPos.y = newPos.y + i * 1.5f;
                    Vector3 offsetPos = transform.position;
                    offsetPos.y = offsetPos.y + 1;
                    Vector3 direction = newPos - offsetPos;

                    rangeAttack(offsetPos, direction,0, myDamageMultipler);
                    lastDrawShape = drawShape.shape.no_shape;//reset

                }
            }
            else
            {
                lastDrawShape = drawShape.shape.no_shape;
                checkShapeDraw(myshape);//call ownself again
            }
        }
        else if (lastDrawShape == drawShape.shape.diagonal_BLTR)//positive
        {
            //in combo

            if (myshape == drawShape.shape.diagonal_TLBR)//negative
            {
                Debug.Log("can combo: " + canCombo.ToString());
                if (canCombo == true)
                {
                    //  canCombo = true;
                    castModeMeleeCombo();
                }

                lastDrawShape = drawShape.shape.no_shape;
            }
            else if (myshape == drawShape.shape.diagonal_BLTR)//positive
            {
                meleeAttack();
                isMeleeComboCount[0] = true;
                myAnimator.SetBool("meleeAttack1", true);
                coolDownMeleeTimer[0] = coolDownMeleeAttackRate;
                StartCoroutine(WaitForAnimation("melee 1", 0));

                lastDrawShape = drawShape.shape.diagonal_BLTR;
            }
            else
            {
                lastDrawShape = drawShape.shape.no_shape;
                checkShapeDraw(myshape);//call ownself again
            }
        }
        else if (lastDrawShape == drawShape.shape.triangle)
        {
            if(myshape == drawShape.shape.square)
            {

            }
            else
            {
                lastDrawShape = drawShape.shape.no_shape;
                checkShapeDraw(myshape);//call ownself again
            }
        }
        else if (lastDrawShape == drawShape.shape.square)
        {

        }
        else if (lastDrawShape == drawShape.shape.diamond)
        {

        }
        else if (lastDrawShape == drawShape.shape.no_shape)
        {
            if (myshape == drawShape.shape.vertical_line)
            {
                if (isAttack == true)
                    return;
                //single attack
                rangeAttackAnimation();
                Vector3 offsetPos = transform.position;
                offsetPos.y = offsetPos.y + 1;
                Vector3 direction = enemy.transform.position - offsetPos;

                rangeAttack(offsetPos, direction,0, myDamageMultipler);
                lastDrawShape = drawShape.shape.no_shape;//reset
                Debug.Log("in vert");
            }
            else if (myshape == drawShape.shape.diagonal_BLTR)//positive
            {
                meleeAttack();
                isMeleeComboCount[0] = true;
                myAnimator.SetBool("meleeAttack1", true);
                coolDownMeleeTimer[0] = coolDownMeleeAttackRate;
                StartCoroutine(WaitForAnimation("melee 1", 0));

                lastDrawShape = drawShape.shape.diagonal_BLTR;

                Debug.Log("do not come in twice");
            }
            else
            {
                lastDrawShape = myshape;
            }
        }
    }
コード例 #2
0
ファイル: mainPlayer.cs プロジェクト: wolong91/MageDuel
    protected override void Start()
    {
        base.Start();
        myDrawShape = GameObject.Find("draw line").GetComponent<drawShape>();

        enemy = GameObject.FindWithTag("Enemy").gameObject;
        lastDrawShape = drawShape.shape.no_shape;

        //StartCoroutine(castingModeCountDown(1.0f));
    }
コード例 #3
0
    public override void ShapeDraw(drawShape.shape myshape)
    {
        // if (isCastModeAnimation == true)
           // return;

        if (lastDrawShape == drawShape.shape.horizontal_line)
        {
            if (myshape == drawShape.shape.vertical_line)
            {
                if (canRangeAttack == true && canMeleeAttack == true)
                {

                    //multiple range attack
                    rangeAttackAnimation();
                    for (int i = 1; i <= 3; i++)//3
                    {
                        Vector3 newPos = new Vector3(enemy.transform.position.x,
                                                     enemy.transform.position.y, enemy.transform.position.z);
                        newPos.y = newPos.y + i * 1.5f;
                        Vector3 offsetPos = transform.position;
                        offsetPos.y = offsetPos.y + 1;
                        Vector3 direction = newPos - offsetPos;

                        rangeAttack(offsetPos, direction,0, myDamageMultipler);

                    }
                }
                lastDrawShape = drawShape.shape.no_shape;//reset
            }
            else
            {
                lastDrawShape = drawShape.shape.no_shape;
                ShapeDraw(myshape);//call ownself again
            }
        }
        else if (lastDrawShape == drawShape.shape.diagonal_BLTR)//positive
        {
            //in combo

            if (myshape == drawShape.shape.diagonal_TLBR)//negative
            {
                //   Debug.Log("can combo: " + canCombo.ToString());
                if (canCombo == true)
                {

                    castModeMeleeCombo();
                }

                lastDrawShape = drawShape.shape.no_shape;
            }
            else
            {
                lastDrawShape = drawShape.shape.no_shape;
                ShapeDraw(myshape);//call ownself again
            }
        }
        else if (lastDrawShape == drawShape.shape.triangle)
        {
            if (myshape == drawShape.shape.square)
            {
                if (canCastSpell[0] == true)//armor spell
                {
                    isKnockBack = false;
                    canCastSpell[0] = false;
                    myArmorPS.Play();
                    UIarmorCD.startCoolDown(spellCastCoolDown[0], canCastSpell, 0);
                    StartCoroutine(spellDurationTimer(spellType.armor_spell, spellDuration[0]));

                }
                lastDrawShape = drawShape.shape.no_shape;
            }
            else if(myshape == drawShape.shape.diamond)//ultimate
            {
                if (chargingBar.fillAmount >= 1)
                {
                //    myUltiCamera.setCharacterDetail(transform,
                //new Vector3(transform.position.x - transform.forward.x * 2, transform.position.y + 3, transform.position.z), !isBlockLeft);
                //    myUltiCamera.enabled = true;
                //    isCastModeAnimation = true;
                //    myUltimatePS.gameObject.transform.position = new Vector3(enemy.transform.position.x, enemy.transform.position.y + 8, enemy.transform.position.z);
                //    myUltimatePS.Play();
                //    StartCoroutine(spellDurationTimer(spellType.ultimate_spell, 5.0f));
                }
                lastDrawShape = drawShape.shape.no_shape;
            }
            else
            {
                lastDrawShape = drawShape.shape.no_shape;
                ShapeDraw(myshape);//call ownself again
            }
        }
        else if (lastDrawShape == drawShape.shape.square)
        {
            if (myshape == drawShape.shape.diamond)
            {
                if (canCastSpell[2] == true)//instant cooldown spell
                {

                    canCastSpell[0] = true;
                    canCastSpell[1] = true;
                    canCastSpell[2] = false;
                    myPassivePS.Play();
                }
                lastDrawShape = drawShape.shape.no_shape;

            }
            else
            {
                lastDrawShape = drawShape.shape.no_shape;
                ShapeDraw(myshape);//call ownself again
            }
        }
        else if (lastDrawShape == drawShape.shape.diamond)
        {
            if (myshape == drawShape.shape.triangle)//speed boost
            {
                if (canCastSpell[1] == true)//speed spell
                {

                    canCastSpell[1] = false;
                    myActivePS.enableEmission = true;
                    normalSpeed = normalSpeed * 2;

                    UIActiveCD.startCoolDown(spellCastCoolDown[1], canCastSpell, 1);
                    StartCoroutine(spellDurationTimer(spellType.active_spell, spellDuration[1]));
                    //StartCoroutine(spellCoolDown(spellCastCoolDown[1], canCastSpell, 1));
                }
                lastDrawShape = drawShape.shape.no_shape;
            }
            else
            {
                lastDrawShape = drawShape.shape.no_shape;
                ShapeDraw(myshape);//call ownself again
            }
        }
        else if (lastDrawShape == drawShape.shape.no_shape)
        {
            if (myshape == drawShape.shape.vertical_line)
            {
                if (canRangeAttack == true && canMeleeAttack == true)
                {
                    //single attack
                    rangeAttackAnimation();
                    Vector3 offsetPos = transform.position;
                    Vector3 offsetPos_enemy = enemy.transform.position;
                    offsetPos.y = offsetPos.y + 1;
                    offsetPos_enemy.y = offsetPos_enemy.y + 1;
                    Vector3 direction = offsetPos_enemy - offsetPos;

                    rangeAttack(offsetPos, direction,0, myDamageMultipler);
                }

                lastDrawShape = drawShape.shape.no_shape;//reset

            }
            else if (myshape == drawShape.shape.diagonal_BLTR)//positive
            {
                if (canRangeAttack == true)//check if can use of melee
                {

                    meleeAttack();
                    isMeleeComboCount[0] = true;
                    myAnimator.SetBool("meleeAttack1", true);
                    coolDownMeleeTimer[0] = coolDownMeleeAttackRate;
                    StartCoroutine(WaitForAnimation("melee 1", 0));

                    lastDrawShape = drawShape.shape.diagonal_BLTR;
                }
                else
                    lastDrawShape = drawShape.shape.no_shape;

            }
            else
            {
                lastDrawShape = myshape;
            }
        }
    }
コード例 #4
0
ファイル: mainPlayer.cs プロジェクト: wolong91/MageDuel
    public void InfernoShapeDraw(drawShape.shape myshape)
    {
        if (lastDrawShape == drawShape.shape.horizontal_line)
        {
            if (myshape == drawShape.shape.vertical_line)
            {
                if (isAttack == true)
                    return;

                //multiple attack
                rangeAttackAnimation();
                for (int i = 0; i < 3; i++)//3
                {
                    Vector3 newPos = new Vector3(enemy.transform.position.x,
                                                 enemy.transform.position.y, enemy.transform.position.z);
                    newPos.y = newPos.y + i * 1.5f;
                    Vector3 offsetPos = transform.position;
                    offsetPos.y = offsetPos.y + 1;
                    Vector3 direction = newPos - offsetPos;

                    rangeAttack(offsetPos, direction,0, myDamageMultipler);
                    lastDrawShape = drawShape.shape.no_shape;//reset

                }
            }
            else
            {
                lastDrawShape = drawShape.shape.no_shape;
                InfernoShapeDraw(myshape);//call ownself again
            }
        }
        else if (lastDrawShape == drawShape.shape.diagonal_BLTR)//positive
        {
            //in combo

            if (myshape == drawShape.shape.diagonal_TLBR)//negative
            {
                //   Debug.Log("can combo: " + canCombo.ToString());
                if (canCombo == true)
                {

                    castModeMeleeCombo();
                }

                lastDrawShape = drawShape.shape.no_shape;
            }
            else if (myshape == drawShape.shape.diagonal_BLTR)//positive
            {

                meleeAttack();
                isMeleeComboCount[0] = true;
                myAnimator.SetBool("meleeAttack1", true);
                coolDownMeleeTimer[0] = coolDownMeleeAttackRate;
                StartCoroutine(WaitForAnimation("melee 1", 0));

                lastDrawShape = drawShape.shape.diagonal_BLTR;
            }
            else
            {
                lastDrawShape = drawShape.shape.no_shape;
                InfernoShapeDraw(myshape);//call ownself again
            }
        }
        else if (lastDrawShape == drawShape.shape.triangle)
        {
            if (myshape == drawShape.shape.square)
            {
                if (canCastSpell[0] == false)//armor spell
                    return;//in cooldown
                Debug.Log("in armor");
                isKnockBack = false;
                canCastSpell[0] = false;
                myArmorPS.Play();
                StartCoroutine(startSpell(spellType.armor_spell, Inferno_spellDuration[0]));
                StartCoroutine(spellCoolDown(Inferno_spellCastCoolDown[0], canCastSpell, 0));
            }
            else
            {
                lastDrawShape = drawShape.shape.no_shape;
                InfernoShapeDraw(myshape);//call ownself again
            }
        }
        else if (lastDrawShape == drawShape.shape.square)
        {

        }
        else if (lastDrawShape == drawShape.shape.diamond)
        {

        }
        else if (lastDrawShape == drawShape.shape.no_shape)
        {
            if (myshape == drawShape.shape.vertical_line)
            {
                if (isAttack == true)
                    return;

                //single attack
                rangeAttackAnimation();
                Vector3 offsetPos = transform.position;
                offsetPos.y = offsetPos.y + 1;
                Vector3 direction = enemy.transform.position - offsetPos;

                rangeAttack(offsetPos, direction,0, myDamageMultipler);
                lastDrawShape = drawShape.shape.no_shape;//reset

            }
            else if (myshape == drawShape.shape.diagonal_BLTR)//positive
            {
                if (canRangeAttack == false)//prevent use of melee
                    return;
                Debug.Log("melee att 1");
                meleeAttack();
                isMeleeComboCount[0] = true;
                myAnimator.SetBool("meleeAttack1", true);
                coolDownMeleeTimer[0] = coolDownMeleeAttackRate;
                StartCoroutine(WaitForAnimation("melee 1", 0));

                lastDrawShape = drawShape.shape.diagonal_BLTR;

            }
            else
            {
                lastDrawShape = myshape;
            }
        }
    }
コード例 #5
0
 public virtual void ShapeDraw(drawShape.shape myshape)
 {
     //empty for overwrite
 }