コード例 #1
0
    void UpdateCutMouse()
    {
        {
            if (!punchScript.Block)
            {
                Vector3 mousePos = Input.mousePosition;
                mousePos.z = z;
                Vector2 newPosition = cam.ScreenToWorldPoint(mousePos);
                cam.gameObject.SetActive(false);
                rb.position = newPosition;

                velocity = (newPosition - previousPosition).magnitude * Time.deltaTime;

                previousPosition = newPosition;

                actualPosition = newPosition;


                if (timeTouch >= minTimeBlock)
                {
                    if (!punchScript.Atacou)
                    {
                        if (TutorialManager.instance.actualState == TutorialManager.States.Pt12 || TutorialManager.instance.actualState == TutorialManager.States.Pt18)
                        {
                            punchScript.GotBlock();
                            //print("block");
                            CountAndCutBool(false);
                        }
                    }
                }
                if (velocity > minCutVelocity)
                {
                    startCounting = false;
                }
                else
                {
                    startCounting = true;
                }
            }
        }
    }
コード例 #2
0
ファイル: PunchIATutorial.cs プロジェクト: jerffesonj/Supapo
    private void EnemyAttack()
    {
        if ((TutorialManager.instance.actualState == TutorialManager.States.Pt12) ||
            (TutorialManager.instance.actualState == TutorialManager.States.Pt14) ||
            (TutorialManager.instance.actualState == TutorialManager.States.Pt16) ||
            (TutorialManager.instance.actualState == TutorialManager.States.Pt18))
        {
            timeToAttack += Time.deltaTime;

            randomTimetoAttack = Random.Range(2, 5);

            if (timeToAttack >= randomTimetoAttack)
            {
                if (punchScript.Block)
                {
                    punchScript.Block = false;
                }
                if (!punchScript.Hit)
                {
                    if (!punchScript.Stunned)
                    {
                        if (!punchScript.Atacou)
                        {
                            int randomMax = 0;
                            if ((TutorialManager.instance.actualState == TutorialManager.States.Pt18))
                            {
                                randomMax = 8;
                            }
                            else
                            {
                                randomMax = 5;
                            }
                            int random = Mathf.RoundToInt((Random.Range(0, randomMax)));
                            //random = 4;
                            switch (random)
                            {
                            case 0:

                                break;

                            case 1:

                                StartCoroutine(WaitForJab());
                                print("atacado");
                                break;

                            case 2:
                                StartCoroutine(WaitForCross());
                                break;

                            case 3:
                                StartCoroutine(WaitForCross());
                                break;

                            case 4:
                                StartCoroutine(WaitForUpper());
                                break;

                            case 5:

                                punchScript.GotBlock();
                                break;

                            case 6:
                                dodgeScript.DodgedLeft();
                                break;

                            case 7:
                                dodgeScript.DodgedRight();
                                break;
                            }
                            print(random);

                            timeToAttack = 0;
                        }
                    }
                }
            }
        }
        else
        {
            //punchScript.block = false;
            //punchScript.dodged = false;
            //punchScript.atacou = false;
            ////punchScript.hit = false;
            //punchScript.stunned = false;
            randomTimetoAttack = 0;
        }
    }