Exemplo n.º 1
0
    private PlayerState TryEndDash(float t, PlayerController playerController)
    {
        if (!dashRequest)
        {
            dashTime -= t;
            if (dashTime <= 0)
            {
                if (playerController.checkIfOnGround())
                {
                    Debug.Log("Went to idle state");
                    return(new PlayerIdleState());
                }
                else
                {
                    playerController.AccessRigidBody().AddForce(Vector2.up * forceOfExtraMovementAtEnd);
                    if (directionOfDash.y > 0)
                    {
                        playerController.AccessRigidBody().AddForce(Vector2.up * forceOfExtraMovementAtEnd);
                    }
                    Debug.Log("Went to Fall state");
                    return(new PlayerFallState());
                }
            }
        }

        return(null);
    }
Exemplo n.º 2
0
 public override void Enter(PlayerController playerController)
 {
     rb = playerController.AccessRigidBody();
     playerController.spriteAnimator.SetBool("Fall", true);
     playerController.spriteAnimator.SetBool("JumpUp", false);
     rb.gravityScale = playerController.CheckInitialGravityScale();
 }
Exemplo n.º 3
0
    //private bool waitForHoldReleaseTrigger = false;

    public override void Enter(PlayerController playerController)
    {
        playerController.AccessRigidBody().velocity = Vector2.zero;
        playerController.canMove = false;

        //Starting should be done in the NPC?
        //DialougeManagerV2.instance.StartDialouge(DialougeManagerV2.instance.testDialouge);
    }
Exemplo n.º 4
0
 public override void Enter(PlayerController playerController)
 {
     playerController.gameManager.gameState = GameManager.GameState.cutscene;
     rb              = playerController.AccessRigidBody();
     rb.velocity     = Vector2.zero;
     rb.gravityScale = 0f;
     playerController.spriteAnimator.SetBool("Hide", true);
     playerController.canMove = false;
 }
Exemplo n.º 5
0
    public override void Enter(PlayerController playerController)
    {
        playerController.heightAnimator.SetTrigger("Stretch");
        playerController.spriteAnimator.SetBool("JumpUp", true);

        ServiceLocator.GetGamepadRumble().StartGamepadRumble(GamepadRumbleProvider.RumbleSize.small);
        ServiceLocator.GetAudio().PlaySound("Player_Jump", SoundType.interuptLast);

        counterName = "Jump";

        initialGravityScale = playerController.CheckInitialGravityScale();
        rb = playerController.AccessRigidBody();
        //rb.velocity = new Vector2(0, 0); //Shouold be in PlayerWallJumpState

        rb.velocity = new Vector2(rb.velocity.x, 0);

        //Jump
        rb.AddForce(Vector2.up * playerController.jumpVelocity, ForceMode2D.Impulse);
        playerController.StopLateJump();
    }
Exemplo n.º 6
0
    public override void Enter(PlayerController playerController)
    {
        playerController.StopFlash();

        Debug.Log("Exited");
        playerController.canMove = false;
        playerController.AccessRigidBody().velocity = Vector2.zero;

        ServiceLocator.GetScreenShake().StartScreenShake(150, 1f);
        ServiceLocator.GetGamepadRumble().StartGamepadRumble(GamepadRumbleProvider.RumbleSize.huge);
        //ServiceLocator.GetAudio().PlaySound("Player_Exit");

        counterName = "Exit";

        //Hides player sprite
        //spriteRenderer = playerController.GetComponent<SpriteRenderer>();
        //spriteRenderer.enabled = false;

        //Need to pin the player to one place
    }
Exemplo n.º 7
0
    public override void Enter(PlayerController playerController)
    {
        playerController.StartTrailCoroutine();
        playerController.heightAnimator.SetTrigger("Stretch");
        playerController.spriteAnimator.SetBool("JumpUp", true);

        ServiceLocator.GetScreenShake().StartScreenShake(2f, 0.2f);
        ServiceLocator.GetGamepadRumble().StartGamepadRumble(GamepadRumbleProvider.RumbleSize.big);
        ServiceLocator.GetAudio().PlaySound("Player_Bounce", SoundType.interuptLast);
        ServiceLocator.GetScreenShake().StartScreenFlash(0.05f, 0.05f);
        counterName = "Bounce";

        //Gets the normal gravity for the player.
        initialGravityScale = playerController.CheckInitialGravityScale();

        //Makes sure the player dosen't have any vertical velocity at the start of the bounce.
        rb          = playerController.AccessRigidBody();
        rb.velocity = new Vector2(rb.velocity.x, 0);

        //The force added for the bounce
        rb.AddForce(Vector2.up * playerController.bounceVelocity, ForceMode2D.Impulse);
        playerController.StopLateJump();
    }
Exemplo n.º 8
0
    public override void Enter(PlayerController playerController)
    {
        playerController.heightAnimator.SetTrigger("Expand");
        //Enter dash, choose correct animation
        //if(playerController.activeHorizontalCommand != PlayerController.PlayerHorizontalCommands.Nothing)

        ServiceLocator.GetAudio().PlaySound("Player_Dash", SoundType.interuptLast);
        counterName = "Dash";

        rb = playerController.AccessRigidBody();
        TurnOffGravity();

        playerController.dashCharges--;
        playerController.canMove = false;

        dashStartDelay = playerController.GetDashStartDelay();
        dashRequest    = true;
        dashTime       = playerController.GetDashTime();



        //FIRE PARTICLES
        //if (playerController.GetPlayerHealth() == 0)
        //{
        //    if (playerController.dashCharges != 0)
        //    {
        //        playerController.redFlameParticles.SetActive(true);
        //        playerController.blueFlameParticles.SetActive(false);
        //    }
        //    else
        //    {
        //        playerController.blueFlameParticles.SetActive(true);
        //        playerController.redFlameParticles.SetActive(false);
        //    }
        //}
    }
Exemplo n.º 9
0
    public override void Enter(PlayerController playerController)
    {
        //playerController.respawnFreeze = true;
        ServiceLocator.GetScreenShake().StartScreenShake(10, 1f);
        ServiceLocator.GetGamepadRumble().StartGamepadRumble(GamepadRumbleProvider.RumbleSize.big);
        ServiceLocator.GetAudio().PlaySound("Player_Death", SoundType.interuptLast);
        ServiceLocator.GetScreenShake().StartScreenFlash(0.05f, 0.1f);

        playerController.deathParticles.Play();
        playerController.redFlameParticles.SetActive(false);
        playerController.blueFlameParticles.SetActive(false);

        playerController.spriteAnimator.SetBool("Death", true);

        counterName = "Death";

        respawnTime = playerController.GetRespawnTime();
        //ServiceLocator.GetScreenShake().StartTransition((int)respawnTime * 30, true);

        playerController.canMove = false;

        //Start screenshake
        //Instantiate specific particleFX

        //Hides player sprite
        //spriteRenderer = playerController.GetComponent<SpriteRenderer>();
        //spriteRenderer.enabled = false;

        //Makes sure the player gets pinned to the place he died
        //Dosen't work!
        rb              = playerController.AccessRigidBody();
        rb.velocity     = Vector2.zero;
        rb.gravityScale = 0;

        rb.constraints = RigidbodyConstraints2D.FreezePosition | RigidbodyConstraints2D.FreezeRotation;
    }
Exemplo n.º 10
0
 public override void Enter(PlayerController playerController)
 {
     playerController.AccessRigidBody().velocity = Vector2.zero;
     playerController.canMove = false;
 }