コード例 #1
0
ファイル: Golpe.cs プロジェクト: jerffesonj/Supapo
    void StopTouchingMouse()
    {
        CountAndCutBool(false);

        if (punchScript.block)
        {
            punchScript.block = false;
            print("semblock");

            return;
        }
        else
        {
            if (velocity > minCutVelocity)
            {
                touchEnd = rb.position;
            }
            if (timeTouch > 0.02f && timeTouch < minTimeBlock && rb.position.x < -3f)
            {
                punchScript.atacou = true;
                punchScript.Jab();
                print("jab");
            }
            else if (timeTouch > 0.02f && timeTouch < minTimeBlock && rb.position.x > -3f)
            {
                punchScript.atacou = true;
                punchScript.Cross();
                print("direto");
            }
            else if ((touchEnd.x != 0) && touchEnd.y != 0)
            {
                if (Mathf.Abs(touchStart.x - touchEnd.x) > Mathf.Abs((touchStart.y - touchEnd.y) / 2))
                {
                    if (touchStart.x > touchEnd.x)
                    {
                        if (!punchScript.atacou)
                        {
                            punchScript.atacou = true;
                            punchScript.HookRight();
                            print("esquerda");
                        }
                    }
                    else if (touchStart.x < touchEnd.x)
                    {
                        if (!punchScript.atacou)
                        {
                            punchScript.atacou = true;
                            punchScript.HookLeft();
                            print("direita");
                        }
                    }
                }
                else if (Mathf.Abs(touchStart.x - touchEnd.x) < Mathf.Abs((touchStart.y - touchEnd.y) / 2))
                {
                    if (touchStart.y < touchEnd.y)
                    {
                        if (!punchScript.atacou)
                        {
                            punchScript.atacou = true;
                            punchScript.Uppercut();
                            print("cima");
                        }
                    }
                    else if (touchStart.y > touchEnd.y)
                    {
                        print("baixo");
                        if (rb.position.x < -3f)
                        {
                            if (!MenuController.instance.UseGyro)
                            {
                                if (!punchScript.hit)
                                {
                                    if (!punchScript.atacou)
                                    {
                                        if (!punchScript.block)
                                        {
                                            if (!punchScript.dodged)
                                            {
                                                if (punchScript.thisHPScript.currentStamina >= punchScript.staminaDodge)
                                                {
                                                    dodgeScript.DodgedLeft();
                                                    print("esquerdo");
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else if (rb.position.x > -3f)
                        {
                            if (!MenuController.instance.UseGyro)
                            {
                                if (!punchScript.hit)
                                {
                                    if (!punchScript.atacou)
                                    {
                                        if (!punchScript.block)
                                        {
                                            if (!punchScript.dodged)
                                            {
                                                if (punchScript.thisHPScript.currentStamina >= punchScript.staminaDodge)
                                                {
                                                    dodgeScript.DodgedRight();
                                                    print("direito");
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        if (currentBladeTrail != null)
        {
            currentBladeTrail.transform.SetParent(null);
            Destroy(currentBladeTrail, 0.5f);
        }
    }