Ejemplo n.º 1
0
    public void PerformPunch()
    {
        if (target.activeSelf)
        {
            targetX = currentAimX - SCR_Gameplay.SCREEN_W * 0.5f;
            targetY = currentAimY;

            if (SCR_Profile.showTutorial == 1)
            {
                SCR_Gameplay.instance.ShowSecurityProgress();
                if (SCR_Gameplay.instance.tutorialStep == TutorialStep.AIM)
                {
                    target.SetActive(false);
                    return;
                }
                if (SCR_Gameplay.instance.tutorialStep == TutorialStep.PUNCH)
                {
                    if (SCR_Helper.DistanceBetweenTwoPoint(targetX, targetY, bossScript.predictX, bossScript.predictY) > PLAYER_TUTORIAL_RANGE)
                    {
                        target.SetActive(false);
                        //return;
                    }
                }
            }


            y = SCR_Gameplay.instance.cameraHeight - PLAYER_SIZE;
            if (y < PLAYER_START_Y)
            {
                y = PLAYER_START_Y;
            }

            if (targetX >= x)
            {
                direction = 1;
            }
            else
            {
                direction = -1;
            }

            flyAngle = SCR_Helper.AngleBetweenTwoPoint(x, y, targetX, targetY);
            speedX   = PLAYER_FLY_SPEED * SCR_Helper.Sin(flyAngle);
            speedY   = PLAYER_FLY_SPEED * SCR_Helper.Cos(flyAngle);

            trail.GetComponent <SCR_Trail>().JumpTo(x, y);
            trail.GetComponent <SCR_Trail>().TurnParticleOn();

            target.SetActive(false);

            SwitchState(PlayerState.FLY_UP);
            SCR_Audio.PlayFlyUpSound();

            ricocheted = false;

            if (SCR_Profile.showTutorial == 1)
            {
                SCR_Gameplay.instance.TriggerTutorial(TutorialStep.FLY_UP);
                bossScript.HideTutorial();
            }
        }
        else
        {
            target.SetActive(false);
        }
    }