Ejemplo n.º 1
0
    void Update()
    {
        float tempY = transform.position.y;

        //When you are dead
        if (lives <= 0)
        {
            hitParticle.Play();
            cameraObject.transform.rotation = Quaternion.Euler(20, 180, 0);
            //Shake screen
            shake.MakeShake();
            //Make player fall to the ground
            tempY -= 0.015f;
            animator.SetBool("isDead", true);
            transform.position = new Vector3(transform.position.x, tempY, transform.position.z);
            Invoke("loadLevel", 2f);
        }
    }
Ejemplo n.º 2
0
    public void SetState(EState state)
    {
        switch (state)
        {
        case EState.Start:
            jumpBGM.Play();
            LeanTween.moveY(this.gameObject, 1.0f, 0.27f).setDelay(0.3f);
            animation.StartAnimation(characterRenderer, (int)EState.Start, 0.1f, () =>
            {
                fadebox.gameObject.SetActive(true);
                LeanTween.alphaCanvas(fadebox, 1, 0.2f).setOnComplete(() => {
                    loading.gameObject.SetActive(true);
                    LeanTween.alphaCanvas(fadebox, 0, 0.2f).setOnComplete(() => {
                        fadebox.gameObject.SetActive(false);
                        loading.gameObject.SetActive(true);
                        LeanTween.alphaCanvas(loading.GetComponent <CanvasGroup>(), 0, 0.3f).setOnComplete(() => {
                            loading.gameObject.SetActive(false);
                            SetGameSetting();
                        }).setDelay(1.0f);
                    });
                });
            }, false);
            break;

        case EState.Finish:

            if (block)
            {
                return;
            }

            ////
            block = true;

            cutAni.gameObject.SetActive(false);
            LeanTween.moveLocalY(this.gameObject, -6.2f, 0.5f).setEaseInBack().setOnComplete(() => {
                shake.MakeShake(10);

                toMain.gameObject.SetActive(true);
                LeanTween.alphaCanvas(toMain, 1, 0.4f).setDelay(0.7f);

                score.text = (meter + 100 * (500 - gameEngine.bossPanel.value)).ToString();
                score.gameObject.SetActive(true);
                LeanTween.scale(score.gameObject, new Vector3(1, 1), 0.4f).setEaseInOutElastic();
                LeanTween.alphaCanvas(score.GetComponent <CanvasGroup>(), 1.0f, 0.4f).setOnComplete(() => {
                    LeanTween.moveLocalY(score.gameObject, 750, 0.4f).setEaseInExpo();
                });
            });


            break;

        case EState.Fly:
            upAni.gameObject.SetActive(true);
            upAni.StartAnimation(upAni.GetComponent <SpriteRenderer>(), 0, 0, null, true);
            THHPManager.Instance.HPDamageStop();
            animation.StartAnimation(characterRenderer, (int)EState.Fly, 0.2f, null, true);

            level += 1;     //레벨 업
            THHPManager.Instance.SetHPToLevel(level);


            if (!fiberBar.isFiberTime)
            {
                fiberBar.gameObject.SetActive(false);
                LeanTween.moveLocalY(characterRenderer.gameObject, 7.5f, 0.6f)
                .setDelay(0.05f)
                .setEaseOutBack()
                .setOnComplete(() => {
                    upAni.gameObject.SetActive(false);
                    SetGameSetting();
                });
            }
            break;

        default:
            break;
        }
    }