Base mechanics done
This commit is contained in:
parent
e4cc23e7f0
commit
eaa8cdd462
67 changed files with 21667 additions and 330 deletions
28
Assets/Scripts/BulletStats.cs
Normal file
28
Assets/Scripts/BulletStats.cs
Normal 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));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue