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

@ -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));
}
}