示例#1
0
    void hitPlatform(PlatformerType platformType)
    {
        currentMove = currentPlayerMoveStatus.Normal;
        animSetBool("isReachedMaxHeight", false);
        animSetBool("isTouchThePlatform", true);
        animTrigger("Jump");

        hitPlatformParticle.Play();
        if (platformType == PlatformerType.Ground)
        {
            currentJumpTime = jumpDuration * 3f;
        }
        else if (platformType == PlatformerType.Final)
        {
            currentJumpTime = jumpDuration * 1000f;
            jumpSpeed      *= 2f;
        }
        else
        {
            currentJumpTime = jumpDuration;
        }

        Invoke("setPlayerMoveToInAir", .2f);

        if (platformType == PlatformerType.Final)
        {
            GameManager._inst.finishLevel();
            finishGameParticle.Play();
            SoundManager._inst.playSoundOnce(SoundEnum.WinSFX);
            SoundManager._inst.setWindProps(.7f * windPower, .02f * windPower);
        }
    }
示例#2
0
    private void FixedUpdate()
    {
        if (GameManager._inst.gameStatus == GameStatus.GameStarted)
        {
            //Rotate The Character to Face The Camera Direction
            var camEluer = mainCam.transform.rotation.eulerAngles;
            transform.rotation = Quaternion.Euler(0f, camEluer.y, 0f);


            if (currentJumpTime > 0f)
            {
                _rigid.AddForce(Vector3.up * Time.deltaTime * jumpSpeed);
                if (!GameManager._inst.isAboutToFinish)
                {
                    SoundManager._inst.setWindProps(.2f * windPower, .007f * windPower);
                }
            }
            else
            {
                if (lastPos.y > transform.position.y)
                {
                    animSetBool("isTouchThePlatform", false);
                    animSetBool("isReachedMaxHeight", true);
                    _rigid.detectCollisions = true;
                    currentMove             = currentPlayerMoveStatus.BackJump;
                    if (!GameManager._inst.isAboutToFinish)
                    {
                        SoundManager._inst.setWindProps(.4f * windPower, .01f * windPower);
                    }
                }
            }


            if (Input.GetMouseButton(0))
            {
                _rigid.position = _rigid.position + transform.forward * Time.fixedDeltaTime * speed;
            }

            currentJumpTime -= Time.fixedDeltaTime;
            lastPos          = transform.position;
        }



        if (GameManager._inst.gameStatus == GameStatus.MainMenu)
        {
            if (GameManager._inst.gameTime > lastPlayingAnimationTime + 2.5f)
            {
                lastPlayingAnimationTime = GameManager._inst.gameTime;
                if (!isTransiningBetweenCharacters)
                {
                    playAnimationInt(animToPlay);

                    if (animToPlay == 1)
                    {
                        Invoke("resetAnimToPlayValue", 2f);
                    }
                    else
                    {
                        Invoke("resetAnimToPlayValue", 1f);
                    }

                    animToPlay++;
                    if (animToPlay > 3)
                    {
                        animToPlay = 1;
                    }
                }
            }
        }
    }
示例#3
0
 void setPlayerMoveToInAir()
 {
     currentMove = currentPlayerMoveStatus.InAir;
 }