public virtual bool CheckTransitionToDashing(PlayerFSM player) { if (!player.mechanics.IsEnabled("Dash")) { return(false); } if (!player.canDash) { return(false); } if (!player.hasResetDashTrigger) { return(false); } if (player.dashCooldownTimer > 0) { return(false); } // GamePad || Keyboard if (Input.GetAxisRaw("Dash") > 0 || Input.GetButtonDown("Dash")) { player.TransitionToState(player.DashingState); return(true); } return(false); }
public void PlayerWait(PlayerFSM player) { player.TransitionToState(player.InWindowState); player.InWindowState.OnWindowExit.AddListener(ExitWindow); spriteRenderer.sprite = openedWithRopeWithPlayerSprite; currentWindowExitState = WindowExitState.PlayerInside; }
public override void Execute(PlayerFSM player) { if (player.DetectorHandler.TryHideInHidePlace()) { player.TransitionToState(player.HiddenState); return; } }
private void OnCollisionStay2D(Collision2D other) { if (other.gameObject.CompareTag("Player")) { PlayerFSM player = other.gameObject.GetComponent <PlayerFSM>(); player.TransitionToState(player.DyingState); } }
public override bool CheckTransitionToFalling(PlayerFSM player) { if (!player.isGrounded) { player.TransitionToState(player.FallingState); return(true); } return(false); }
public override bool CheckTransitionToFalling(PlayerFSM player) { if (stickyTimer <= 0 || !player.isTouchingWall) { player.TransitionToState(player.FallingState); return(true); } return(false); }
public virtual bool CheckTransitionToGrounded(PlayerFSM player) { if (player.isGrounded) { player.TransitionToState(player.GroundedState); return(true); } return(false); }
public override bool CheckTransitionToFalling(PlayerFSM player) { float xInput = Input.GetAxisRaw("Horizontal"); if (!Input.GetButton("Jump") || xInput != 0) { player.TransitionToState(player.FallingState); return(true); } return(false); }
public bool CheckDettachmentFromWall(PlayerFSM player) { if (!player.mechanics.IsEnabled("Wall Jump")) { if (Input.GetButtonDown("Jump")) { player.TransitionToState(player.FallingState); return(true); } } return(false); }
public override bool CheckTransitionToWallSliding(PlayerFSM player) { if (!player.mechanics.IsEnabled("Wall Slide")) { return(false); } if (player.isTouchingWall) { player.TransitionToState(player.WallSlidingState); return(true); } return(false); }
public override bool CheckTransitionToGrounded(PlayerFSM player) { if (player.isGrounded) { Manager.audio.Play("Landing"); player.leftSideParticles.Play(); player.rightSideParticles.Play(); player.TransitionToState(player.GroundedState); return(true); } return(false); }
public virtual bool CheckTransitionToGunBoots(PlayerFSM player) { if (!player.mechanics.IsEnabled("Gun Boots")) { return(false); } if (Input.GetAxisRaw("Gun Boots") > 0 || Input.GetButton("Gun Boots")) { player.TransitionToState(player.GunBootsState); return(true); } return(false); }
public virtual bool CheckTransitionToJumping(PlayerFSM player) { if (!player.mechanics.IsEnabled("Jump")) { return(false); } if (Input.GetButtonDown("Jump") || player.bunnyHopTimer > 0) { player.TransitionToState(player.JumpingState); return(true); } return(false); }
public bool CheckTransitionToPogoing(PlayerFSM player) { if (!player.mechanics.IsEnabled("Pogo Jump")) { return(false); } if (shouldPogo) { shouldPogo = false; player.TransitionToState(player.PogoingState); return(true); } return(false); }
public override bool CheckTransitionToGrounded(PlayerFSM player) { if (!player.isGrounded) { return(false); } float xInput = Input.GetAxisRaw("Horizontal"); if (xInput == 0) { player.TransitionToState(player.GroundedState); return(true); } return(false); }
IEnumerator EnterWindowAnimation(PlayerFSM player) { SetVirtualCameraPriority(11); windowExit.SetVirtualCameraPriority(12); player.TransitionToState(player.DisableState); player.Visibility.SetVisibilityState(HeyEscape.Core.Player.VisibilityState.State.Hidden); player.PlayerMovement.SetEnabled(true); while ((player.transform.position - climbPoint.position).sqrMagnitude > 0.2f * 0.2f) { player.transform.position = Vector3.SmoothDamp(player.transform.position, climbPoint.position, ref currentVelocity, 0.1f); yield return(null); } windowExit.SetEnabledVirtualCamera(true); player.VirtualCamera.gameObject.SetActive(false); player.Rigidbody2D.velocity = new Vector2(0, 0); player.Animator.SetTrigger("WindowClimbing"); player.LightVision.SetVisionState(HeyEscape.Core.Player.PlayerLightVision.VisionState.InDoor); yield return(delay); if (player.Renderer != null) { player.Renderer.enabled = false; } player.transform.position = windowExit.GetExitPointPosition(); player.Rigidbody2D.velocity = new Vector2(0, 0); yield return(delay); windowExit.PlayerFallAnimation(0.5f); yield return(delay); windowExit.OpenWindow(); yield return(delay); player.LightVision.SetVisionState(HeyEscape.Core.Player.PlayerLightVision.VisionState.Full); player.PlayerMovement.SetEnabled(false); windowExit.PlayerWait(player); }
public virtual bool CheckTransitionToWalking(PlayerFSM player) { if (!player.mechanics.IsEnabled("Walk")) { return(false); } float xInput = Input.GetAxisRaw("Horizontal"); if (xInput != 0) { player.TransitionToState(player.WalkingState); return(true); } return(false); }
public virtual bool CheckTransitionToFalling(PlayerFSM player) { if (player.isGrounded) { return(false); } bool playerIsFalling = player.rb.velocity.y <= 0; bool playerStoppedJumping = player.rb.velocity.y > 0 && !Input.GetButton("Jump"); if (playerIsFalling || playerStoppedJumping) { player.TransitionToState(player.FallingState); return(true); } return(false); }
public virtual bool CheckTransitionToDoubleJumping(PlayerFSM player) { if (!player.mechanics.IsEnabled("Double Jump")) { return(false); } if (!player.canDoubleJump) { return(false); } if (Input.GetButtonDown("Jump") || player.airJumpInputBufferTimer > 0) { player.TransitionToState(player.DoubleJumpingState); return(true); } return(false); }
public virtual bool CheckTransitionToWallSliding(PlayerFSM player) { if (!player.mechanics.IsEnabled("Wall Slide")) { return(false); } float xInput = Input.GetAxisRaw("Horizontal"); bool pressingAgainstLeftWall = player.isTouchingLeftWall && xInput < 0; bool pressingAgainstRightWall = player.isTouchingRightWall && xInput > 0; if (pressingAgainstLeftWall || pressingAgainstRightWall) { player.TransitionToState(player.WallSlidingState); return(true); } return(false); }
public virtual bool CheckTransitionToExploding(PlayerFSM player) { if (!player.mechanics.IsEnabled("Explosion")) { return(false); } if (player.explosionCooldownTimer > 0) { return(false); } if (Input.GetButtonDown("Explosion")) { player.TransitionToState(player.ExplodingState); return(true); } return(false); }
public virtual bool CheckTransitionToBlinking(PlayerFSM player) { if (!player.mechanics.IsEnabled("Blink")) { return(false); } if (player.blinkCooldownTimer > 0) { return(false); } if (Input.GetButtonDown("Blink")) { player.TransitionToState(player.BlinkingState); return(true); } return(false); }
public virtual bool CheckTransitionToWallJumping(PlayerFSM player) { if (!player.mechanics.IsEnabled("Wall Jump")) { return(false); } if (!player.isTouchingWall) { return(false); } if (Input.GetButtonDown("Jump")) { player.TransitionToState(player.WallJumpingState); return(true); } return(false); }
private void KillPlayer(GameObject collidedObj) { PlayerFSM player = collidedObj.GetComponent <PlayerFSM>(); player.TransitionToState(player.DyingState); }
private void KillPlayer() { player.TransitionToState(player.DyingState); }
public override void Execute(PlayerFSM player) { player.Rigidbody2D.AddForce(new Vector2(0f, player.PlayerAttributes.JumpForce)); player.TransitionToState(player.JumpingState); }