johnnygoodguy2000

PlayerState

Oct 18th, 2025 (edited)
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | Gaming | 0 0
  1. //using System.Numerics;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5.  
  6. public abstract class PlayerState
  7. {
  8.     protected Player player;
  9.     protected Animator anim;
  10.     protected Rigidbody2D rb;
  11.     protected Combat combat;
  12.     protected bool JumpPressed  { get => player.jumpPressed;  set => player.jumpPressed  = value; }
  13.     protected bool JumpReleased { get => player.jumpReleased; set => player.jumpReleased = value; }
  14.     protected bool RunPressed => player.runPressed;
  15.     protected bool AttackPressed => player.attackPressed;
  16.     protected Vector2 MoveInput => player.moveInput;  
  17.    
  18.  
  19.     public PlayerState(Player player)
  20.     {
  21.         this.player = player;
  22.         this.anim = player.anim;
  23.        // this.rb = player.rb ?? player.GetComponent<Rigidbody2D>();
  24.        this.rb = player.rb;
  25.         combat = player.combat;
  26.  
  27.     }
  28.     public virtual void Enter() { }
  29.     public virtual void Exit() { }
  30.  
  31.     public virtual void Update() { }
  32.     public virtual void FixedUpdate() { }
  33.     public virtual void AttackAnimationFinished() { }
  34.    
  35. }
Tags: playerState
Advertisement
Add Comment
Please, Sign In to add comment