コード例 #1
0
    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);
    }
コード例 #2
0
 public void PlayerWait(PlayerFSM player)
 {
     player.TransitionToState(player.InWindowState);
     player.InWindowState.OnWindowExit.AddListener(ExitWindow);
     spriteRenderer.sprite  = openedWithRopeWithPlayerSprite;
     currentWindowExitState = WindowExitState.PlayerInside;
 }
コード例 #3
0
ファイル: HideCommand.cs プロジェクト: KLEEEEEER/hey-escape
 public override void Execute(PlayerFSM player)
 {
     if (player.DetectorHandler.TryHideInHidePlace())
     {
         player.TransitionToState(player.HiddenState);
         return;
     }
 }
コード例 #4
0
 private void OnCollisionStay2D(Collision2D other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         PlayerFSM player = other.gameObject.GetComponent <PlayerFSM>();
         player.TransitionToState(player.DyingState);
     }
 }
コード例 #5
0
 public override bool CheckTransitionToFalling(PlayerFSM player)
 {
     if (!player.isGrounded)
     {
         player.TransitionToState(player.FallingState);
         return(true);
     }
     return(false);
 }
コード例 #6
0
 public override bool CheckTransitionToFalling(PlayerFSM player)
 {
     if (stickyTimer <= 0 || !player.isTouchingWall)
     {
         player.TransitionToState(player.FallingState);
         return(true);
     }
     return(false);
 }
コード例 #7
0
    public virtual bool CheckTransitionToGrounded(PlayerFSM player)
    {
        if (player.isGrounded)
        {
            player.TransitionToState(player.GroundedState);
            return(true);
        }

        return(false);
    }
コード例 #8
0
    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);
    }
コード例 #9
0
 public bool CheckDettachmentFromWall(PlayerFSM player)
 {
     if (!player.mechanics.IsEnabled("Wall Jump"))
     {
         if (Input.GetButtonDown("Jump"))
         {
             player.TransitionToState(player.FallingState);
             return(true);
         }
     }
     return(false);
 }
コード例 #10
0
    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);
    }
コード例 #11
0
    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);
    }
コード例 #12
0
    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);
    }
コード例 #13
0
    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);
    }
コード例 #14
0
    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);
    }
コード例 #15
0
    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);
    }
コード例 #16
0
ファイル: WindowEnter.cs プロジェクト: KLEEEEEER/hey-escape
        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);
        }
コード例 #17
0
    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);
    }
コード例 #18
0
    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);
    }
コード例 #19
0
    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);
    }
コード例 #20
0
    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);
    }
コード例 #21
0
    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);
    }
コード例 #22
0
    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);
    }
コード例 #23
0
    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);
    }
コード例 #24
0
    private void KillPlayer(GameObject collidedObj)
    {
        PlayerFSM player = collidedObj.GetComponent <PlayerFSM>();

        player.TransitionToState(player.DyingState);
    }
コード例 #25
0
 private void KillPlayer()
 {
     player.TransitionToState(player.DyingState);
 }
コード例 #26
0
ファイル: JumpCommand.cs プロジェクト: KLEEEEEER/hey-escape
 public override void Execute(PlayerFSM player)
 {
     player.Rigidbody2D.AddForce(new Vector2(0f, player.PlayerAttributes.JumpForce));
     player.TransitionToState(player.JumpingState);
 }