Base mechanics done

This commit is contained in:
Gerard Gascón 2023-08-20 17:27:37 +02:00
parent e4cc23e7f0
commit eaa8cdd462
67 changed files with 21667 additions and 330 deletions

View file

@ -21,6 +21,10 @@ public class BalanceCanvas : MonoBehaviour {
[SerializeField] Slider gravitySlider;
[SerializeField] Slider coyoteTime;
[SerializeField] Slider bufferTime;
[SerializeField] Slider bulletSpeed;
[SerializeField] Slider maxYSpeed;
[SerializeField] Slider maxBounces;
[SerializeField] Slider maxBullets;
// Start is called before the first frame update
void Awake() {
@ -37,6 +41,10 @@ public class BalanceCanvas : MonoBehaviour {
SetupSlider(gravitySlider, nameof(PlayerStats.Rb.gravityScale));
SetupSlider(coyoteTime, nameof(PlayerStats.coyoteTime));
SetupSlider(bufferTime, nameof(PlayerStats.bufferTime));
SetupSlider(bulletSpeed, nameof(BulletStats.bulletSpeed));
SetupSlider(maxYSpeed, nameof(BulletStats.maxYSpeed));
SetupSlider(maxBounces, nameof(BulletStats.maxBounces));
SetupSlider(maxBullets, nameof(PlayerStats.maxBullets));
}
void SliderChangedCallback(float arg0) => sliderChangedCallback?.Invoke();

View file

@ -0,0 +1,28 @@
using System;
using UnityEngine;
public abstract class BulletStats : MonoBehaviour{
[HideInInspector] public float bulletSpeed = 10f;
[HideInInspector] public float maxYSpeed = 4f;
[HideInInspector] public int maxBounces = 3;
protected Rigidbody2D Rb { get; private set; }
protected virtual void Start() {
Rb = GetComponent<Rigidbody2D>();
BalanceCanvas.instance.sliderChangedCallback += RefreshStats;
RefreshStats();
}
void OnDestroy() {
BalanceCanvas.instance.sliderChangedCallback -= RefreshStats;
}
void RefreshStats() {
bulletSpeed = PlayerPrefs.GetFloat(nameof(bulletSpeed), bulletSpeed);
maxYSpeed = PlayerPrefs.GetFloat(nameof(maxYSpeed), maxYSpeed);
maxBounces = Mathf.RoundToInt(PlayerPrefs.GetFloat(nameof(maxBounces), maxBounces));
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 33e86307d7fb44eea793219782ecdd8f
timeCreated: 1692530272

View file

@ -1,12 +1,9 @@
using UnityEngine;
namespace Level1 {
public class Bullet1 : MonoBehaviour {
[SerializeField] float speed;
public class Bullet1 : BulletStats {
public void AddForce(int direction) {
Rigidbody2D rb = GetComponent<Rigidbody2D>();
rb.velocity = Vector2.right * direction * speed;
GetComponent<Rigidbody2D>().velocity = Vector2.right * direction * bulletSpeed;
}
void OnCollisionEnter2D(Collision2D other) {

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7853184c6b88d0b4dadbc7d63e559d42
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,34 @@
using System;
using UnityEngine;
namespace Level10 {
public class Bullet10 : BulletStats {
int _currentBounces;
protected override void Start() {
base.Start();
_currentBounces = maxBounces;
}
void FixedUpdate() {
if (Rb.velocity.y <= maxYSpeed) return;
Vector2 velocity = Rb.velocity;
velocity.y = maxYSpeed;
Rb.velocity = velocity;
}
public void AddForce(int direction) {
++PlayerMovement10.instance.Bullets;
GetComponent<Rigidbody2D>().velocity = Vector2.right * direction * bulletSpeed;
}
void OnCollisionEnter2D(Collision2D other) {
--_currentBounces;
if (_currentBounces != 0 && !other.gameObject.CompareTag("Enemy")) return;
--PlayerMovement10.instance.Bullets;
Destroy(gameObject);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c61fddf6fd9b8364ab375bfdf61b07f8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,48 @@
using UnityEngine;
namespace Level10 {
public class Enemy10 : MonoBehaviour {
[SerializeField] float speed;
[SerializeField] LayerMask groundLayer;
[SerializeField] Transform sprite;
[Header("Flipping Pivots")]
[SerializeField] Transform flippingPivotLeft;
[SerializeField] Transform flippingPivotRight;
int _facingDirection = 1;
Rigidbody2D _rb;
// Start is called before the first frame update
void Awake() {
_rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void FixedUpdate() {
if (_facingDirection > 0) {
if (Physics2D.OverlapBox(flippingPivotRight.position, flippingPivotRight.localScale, 0, groundLayer)) {
_facingDirection = -1;
sprite.localScale = new Vector3(-1, 1, 1);
}
}else {
if (Physics2D.OverlapBox(flippingPivotLeft.position, flippingPivotLeft.localScale, 0, groundLayer)) {
_facingDirection = 1;
sprite.localScale = Vector3.one;
}
}
_rb.velocity = new Vector2(speed * _facingDirection, _rb.velocity.y);
}
void OnDrawGizmos() {
if(!flippingPivotLeft || !flippingPivotRight) return;
Gizmos.color = Color.red;
Gizmos.DrawWireCube(flippingPivotLeft.position, flippingPivotLeft.localScale);
Gizmos.DrawWireCube(flippingPivotRight.position, flippingPivotRight.localScale);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ddb4161c31284e74889fbdc8de814976
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,21 @@
using UnityEngine;
namespace Level10 {
public class EnemyWeakPoint10 : MonoBehaviour {
Enemy10 _enemy;
void Awake() {
_enemy = GetComponentInParent<Enemy10>();
}
void OnTriggerEnter2D(Collider2D other) {
if (!other.CompareTag("Player")) return;
PlayerMovement10 player = other.GetComponent<PlayerMovement10>();
player.Rb.velocity = new Vector2(player.Rb.velocity.x, player.deathForce);
player.Animator.SetTrigger(PlayerMovement10.Jump1);
Destroy(_enemy.gameObject);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 974d49e3395c01d43948e17ce1640f96
timeCreated: 1691603524

View file

@ -0,0 +1,114 @@
using UnityEngine;
using UnityEngine.InputSystem;
namespace Level10 {
public class PlayerMovement10 : PlayerStats {
[Header("Shooting")]
[SerializeField] Bullet10 bullet;
[SerializeField] Transform shootingPos;
[Header("Physics")]
[SerializeField] LayerMask groundMask;
[SerializeField] Vector2 feetSize;
float _horizontalInput;
float _xVelocity, _accelerationVelocity;
float _currentCoyoteTime, _currentBufferTime;
bool _grounded;
public int Bullets { set; get; }
int _facingDirection = 1;
PlayerInput _playerInput;
[Header("Animations")]
[SerializeField] Animator animator;
public Animator Animator => animator;
public static readonly int Jump1 = Animator.StringToHash("Jump");
static readonly int XVelocity = Animator.StringToHash("xVelocity");
static readonly int YVelocity = Animator.StringToHash("yVelocity");
static readonly int Grounded = Animator.StringToHash("Grounded");
public static PlayerMovement10 instance;
void Awake() {
instance = this;
_playerInput = new PlayerInput();
_playerInput.Gameplay.Horizontal.started += HorizontalHandler;
_playerInput.Gameplay.Horizontal.performed += HorizontalHandler;
_playerInput.Gameplay.Horizontal.canceled += HorizontalHandler;
_playerInput.Gameplay.Jump.started += Jump;
_playerInput.Gameplay.Jump.canceled += Jump;
_playerInput.Gameplay.Fire.performed += Fire;
}
void Jump(InputAction.CallbackContext obj) {
if (obj.started) {
_currentBufferTime = bufferTime;
}else if (obj.canceled) {
if (Rb.velocity.y < 0f) return;
Rb.velocity = new Vector2(Rb.velocity.x, Rb.velocity.y * jumpCancellationMultiplier);
}
}
void Fire(InputAction.CallbackContext obj) {
if (Bullets >= maxBullets) return;
Bullet10 bullet10 = Instantiate(bullet, shootingPos.position, Quaternion.identity);
bullet10.AddForce(_facingDirection);
}
void HorizontalHandler(InputAction.CallbackContext obj) {
_horizontalInput = obj.ReadValue<float>();
_facingDirection = _horizontalInput > 0 ? 1 : _horizontalInput < 0 ? -1 : _facingDirection;
transform.localScale = new Vector3(_facingDirection, 1, 1);
}
void OnEnable() {
_playerInput.Enable();
}
void OnDisable() {
_playerInput.Disable();
}
// Update is called once per frame
void Update() {
animator.SetFloat(XVelocity, Mathf.Abs(_xVelocity));
animator.SetFloat(YVelocity, Rb.velocity.y);
animator.SetBool(Grounded, _grounded);
if (_currentBufferTime > 0f && _currentCoyoteTime > 0f) {
Rb.velocity = new Vector2(Rb.velocity.x, jumpForce);
animator.SetTrigger(Jump1);
_currentBufferTime = _currentCoyoteTime = 0f;
}
_currentCoyoteTime -= Time.deltaTime;
_currentBufferTime -= Time.deltaTime;
}
void FixedUpdate() {
_grounded = Physics2D.OverlapBox(transform.position, feetSize, 0, groundMask);
if (_grounded && Rb.velocity.y < .1f)
_currentCoyoteTime = coyoteTime;
_xVelocity = Rb.velocity.x;
_xVelocity = Mathf.SmoothDamp(_xVelocity, _horizontalInput * speed, ref _accelerationVelocity,
acceleration);;
Rb.velocity = new Vector2(_xVelocity, Rb.velocity.y);
}
void OnDrawGizmos() {
Gizmos.color = Color.red;
Gizmos.DrawWireCube(transform.position, feetSize);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f9a9f318f92744b4f81879c9ef556dda
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,12 +1,9 @@
using UnityEngine;
namespace Level2 {
public class Bullet2 : MonoBehaviour {
[SerializeField] float speed;
public class Bullet2 : BulletStats {
public void AddForce(int direction) {
Rigidbody2D rb = GetComponent<Rigidbody2D>();
rb.velocity = Vector2.right * direction * speed;
GetComponent<Rigidbody2D>().velocity = Vector2.right * direction * bulletSpeed;
}
void OnCollisionEnter2D(Collision2D other) {

View file

@ -1,12 +1,9 @@
using UnityEngine;
namespace Level3 {
public class Bullet3 : MonoBehaviour {
[SerializeField] float speed;
public class Bullet3 : BulletStats {
public void AddForce(int direction) {
Rigidbody2D rb = GetComponent<Rigidbody2D>();
rb.velocity = Vector2.right * direction * speed;
GetComponent<Rigidbody2D>().velocity = Vector2.right * direction * bulletSpeed;
}
void OnCollisionEnter2D(Collision2D other) {

View file

@ -1,12 +1,9 @@
using UnityEngine;
namespace Level4 {
public class Bullet4 : MonoBehaviour {
[SerializeField] float speed;
public class Bullet4 : BulletStats {
public void AddForce(int direction) {
Rigidbody2D rb = GetComponent<Rigidbody2D>();
rb.velocity = Vector2.right * direction * speed;
GetComponent<Rigidbody2D>().velocity = Vector2.right * direction * bulletSpeed;
}
void OnCollisionEnter2D(Collision2D other) {

View file

@ -1,12 +1,9 @@
using UnityEngine;
namespace Level5 {
public class Bullet5 : MonoBehaviour {
[SerializeField] float speed;
public class Bullet5 : BulletStats {
public void AddForce(int direction) {
Rigidbody2D rb = GetComponent<Rigidbody2D>();
rb.velocity = Vector2.right * direction * speed;
GetComponent<Rigidbody2D>().velocity = Vector2.right * direction * maxYSpeed;
}
void OnCollisionEnter2D(Collision2D other) {

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 86e2699d81c3b03418a02e82a17f2670
guid: 4b57f6479871e324890d64de4a9073a0
folderAsset: yes
DefaultImporter:
externalObjects: {}

View file

@ -1,16 +1,22 @@
using UnityEngine;
namespace Level8 {
public class Bullet8 : MonoBehaviour {
[SerializeField] float speed;
public class Bullet8 : BulletStats {
void FixedUpdate() {
if (Rb.velocity.y <= maxYSpeed) return;
Vector2 velocity = Rb.velocity;
velocity.y = maxYSpeed;
Rb.velocity = velocity;
}
public void AddForce(int direction) {
Rigidbody2D rb = GetComponent<Rigidbody2D>();
rb.velocity = Vector2.right * direction * speed;
GetComponent<Rigidbody2D>().velocity = Vector2.right * direction * bulletSpeed;
}
void OnCollisionEnter2D(Collision2D other) {
Destroy(gameObject);
if (other.gameObject.CompareTag("Enemy")) {
Destroy(gameObject);
}
}
}
}

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 07abba302fe75e04c8485e7a5ae40dcb
guid: e8589b066efc2a44782262ccea1a924e
MonoImporter:
externalObjects: {}
serializedVersion: 2

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8f8ff3b239fcea04b91b8c49085c0cdb
guid: a59820a761d4477468f1cc9da75eca3d
MonoImporter:
externalObjects: {}
serializedVersion: 2

View file

@ -1,3 +1,3 @@
fileFormatVersion: 2
guid: 07622b149a150ff4c9470ed89e7347c8
guid: 3c59ba55a285218468f7cb423b1aa267
timeCreated: 1691603524

View file

@ -1,16 +0,0 @@
using UnityEngine;
namespace Level8 {
public class PlayerFollower8 : MonoBehaviour {
public void SetPosition(Vector3 position, bool grounded) {
if (grounded) {
transform.position = position;
return;
}
Vector3 pos = transform.position;
pos.x = position.x;
transform.position = pos;
}
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: fa9b72934e014867b4b865e119ad0f0b
timeCreated: 1692381164

View file

@ -3,9 +3,7 @@ using UnityEngine.InputSystem;
namespace Level8 {
public class PlayerMovement8 : PlayerStats {
[SerializeField] PlayerFollower8 playerFollower8;
[Header("Shooting")]
[SerializeField] Bullet8 bullet;
[SerializeField] Transform shootingPos;
@ -88,8 +86,6 @@ namespace Level8 {
_currentCoyoteTime -= Time.deltaTime;
_currentBufferTime -= Time.deltaTime;
playerFollower8.SetPosition(transform.position, _grounded);
}
void FixedUpdate() {

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cd40848ae407e14418cf25c22f6f4be5
guid: 51ca43f5f9e97404da11f9669675fdee
MonoImporter:
externalObjects: {}
serializedVersion: 2

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 62d36cd967aed3d4c80ef57c6f2c7110
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,32 @@
using System;
using UnityEngine;
namespace Level9 {
public class Bullet9 : BulletStats {
int _currentBounces;
protected override void Start() {
base.Start();
_currentBounces = maxBounces;
}
void FixedUpdate() {
if (Rb.velocity.y <= maxYSpeed) return;
Vector2 velocity = Rb.velocity;
velocity.y = maxYSpeed;
Rb.velocity = velocity;
}
public void AddForce(int direction) {
GetComponent<Rigidbody2D>().velocity = Vector2.right * direction * bulletSpeed;
}
void OnCollisionEnter2D(Collision2D other) {
--_currentBounces;
if (_currentBounces != 0 && !other.gameObject.CompareTag("Enemy")) return;
Destroy(gameObject);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 927f706204d8ea44bba9700d29939338
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,48 @@
using UnityEngine;
namespace Level9 {
public class Enemy9 : MonoBehaviour {
[SerializeField] float speed;
[SerializeField] LayerMask groundLayer;
[SerializeField] Transform sprite;
[Header("Flipping Pivots")]
[SerializeField] Transform flippingPivotLeft;
[SerializeField] Transform flippingPivotRight;
int _facingDirection = 1;
Rigidbody2D _rb;
// Start is called before the first frame update
void Awake() {
_rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void FixedUpdate() {
if (_facingDirection > 0) {
if (Physics2D.OverlapBox(flippingPivotRight.position, flippingPivotRight.localScale, 0, groundLayer)) {
_facingDirection = -1;
sprite.localScale = new Vector3(-1, 1, 1);
}
}else {
if (Physics2D.OverlapBox(flippingPivotLeft.position, flippingPivotLeft.localScale, 0, groundLayer)) {
_facingDirection = 1;
sprite.localScale = Vector3.one;
}
}
_rb.velocity = new Vector2(speed * _facingDirection, _rb.velocity.y);
}
void OnDrawGizmos() {
if(!flippingPivotLeft || !flippingPivotRight) return;
Gizmos.color = Color.red;
Gizmos.DrawWireCube(flippingPivotLeft.position, flippingPivotLeft.localScale);
Gizmos.DrawWireCube(flippingPivotRight.position, flippingPivotRight.localScale);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b2cb099ac388ca14db89b7b03ac720ff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,21 @@
using UnityEngine;
namespace Level9 {
public class EnemyWeakPoint9 : MonoBehaviour {
Enemy9 _enemy;
void Awake() {
_enemy = GetComponentInParent<Enemy9>();
}
void OnTriggerEnter2D(Collider2D other) {
if (!other.CompareTag("Player")) return;
PlayerMovement9 player = other.GetComponent<PlayerMovement9>();
player.Rb.velocity = new Vector2(player.Rb.velocity.x, player.deathForce);
player.Animator.SetTrigger(PlayerMovement9.Jump1);
Destroy(_enemy.gameObject);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9ff7b393dcd3e084a8d10edefea7e758
timeCreated: 1691603524

View file

@ -0,0 +1,107 @@
using UnityEngine;
using UnityEngine.InputSystem;
namespace Level9 {
public class PlayerMovement9 : PlayerStats {
[Header("Shooting")]
[SerializeField] Bullet9 bullet;
[SerializeField] Transform shootingPos;
[Header("Physics")]
[SerializeField] LayerMask groundMask;
[SerializeField] Vector2 feetSize;
float _horizontalInput;
float _xVelocity, _accelerationVelocity;
float _currentCoyoteTime, _currentBufferTime;
bool _grounded;
int _facingDirection = 1;
PlayerInput _playerInput;
[Header("Animations")]
[SerializeField] Animator animator;
public Animator Animator => animator;
public static readonly int Jump1 = Animator.StringToHash("Jump");
static readonly int XVelocity = Animator.StringToHash("xVelocity");
static readonly int YVelocity = Animator.StringToHash("yVelocity");
static readonly int Grounded = Animator.StringToHash("Grounded");
void Awake() {
_playerInput = new PlayerInput();
_playerInput.Gameplay.Horizontal.started += HorizontalHandler;
_playerInput.Gameplay.Horizontal.performed += HorizontalHandler;
_playerInput.Gameplay.Horizontal.canceled += HorizontalHandler;
_playerInput.Gameplay.Jump.started += Jump;
_playerInput.Gameplay.Jump.canceled += Jump;
_playerInput.Gameplay.Fire.performed += Fire;
}
void Jump(InputAction.CallbackContext obj) {
if (obj.started) {
_currentBufferTime = bufferTime;
}else if (obj.canceled) {
if (Rb.velocity.y < 0f) return;
Rb.velocity = new Vector2(Rb.velocity.x, Rb.velocity.y * jumpCancellationMultiplier);
}
}
void Fire(InputAction.CallbackContext obj) {
Bullet9 bullet9 = Instantiate(bullet, shootingPos.position, Quaternion.identity);
bullet9.AddForce(_facingDirection);
}
void HorizontalHandler(InputAction.CallbackContext obj) {
_horizontalInput = obj.ReadValue<float>();
_facingDirection = _horizontalInput > 0 ? 1 : _horizontalInput < 0 ? -1 : _facingDirection;
transform.localScale = new Vector3(_facingDirection, 1, 1);
}
void OnEnable() {
_playerInput.Enable();
}
void OnDisable() {
_playerInput.Disable();
}
// Update is called once per frame
void Update() {
animator.SetFloat(XVelocity, Mathf.Abs(_xVelocity));
animator.SetFloat(YVelocity, Rb.velocity.y);
animator.SetBool(Grounded, _grounded);
if (_currentBufferTime > 0f && _currentCoyoteTime > 0f) {
Rb.velocity = new Vector2(Rb.velocity.x, jumpForce);
animator.SetTrigger(Jump1);
_currentBufferTime = _currentCoyoteTime = 0f;
}
_currentCoyoteTime -= Time.deltaTime;
_currentBufferTime -= Time.deltaTime;
}
void FixedUpdate() {
_grounded = Physics2D.OverlapBox(transform.position, feetSize, 0, groundMask);
if (_grounded && Rb.velocity.y < .1f)
_currentCoyoteTime = coyoteTime;
_xVelocity = Rb.velocity.x;
_xVelocity = Mathf.SmoothDamp(_xVelocity, _horizontalInput * speed, ref _accelerationVelocity,
acceleration);;
Rb.velocity = new Vector2(_xVelocity, Rb.velocity.y);
}
void OnDrawGizmos() {
Gizmos.color = Color.red;
Gizmos.DrawWireCube(transform.position, feetSize);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 03de5002a9f63384a82582a5a3c96aa1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -9,6 +9,7 @@ public abstract class PlayerStats : MonoBehaviour{
[HideInInspector] public float jumpCancellationMultiplier = .5f;
[HideInInspector] public float coyoteTime = .1f;
[HideInInspector] public float bufferTime = .1f;
[HideInInspector] public int maxBullets = 2;
public Rigidbody2D Rb { get; private set; }
@ -32,5 +33,6 @@ public abstract class PlayerStats : MonoBehaviour{
Rb.gravityScale = PlayerPrefs.GetFloat(nameof(Rb.gravityScale), Rb.gravityScale);
coyoteTime = PlayerPrefs.GetFloat(nameof(coyoteTime), coyoteTime);
bufferTime = PlayerPrefs.GetFloat(nameof(bufferTime), bufferTime);
maxBullets = Mathf.RoundToInt(PlayerPrefs.GetFloat(nameof(maxBullets), maxBullets));
}
}