autobalance
This commit is contained in:
parent
b8e5cad380
commit
88063d164e
@ -22,12 +22,10 @@ public struct StatReturn
|
|||||||
public float Damage;
|
public float Damage;
|
||||||
public float MoveSpeed;
|
public float MoveSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
characterAnimator = characterSprite.GetComponent<Animator>();
|
characterAnimator = characterSprite.GetComponent<Animator>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
@ -58,14 +56,10 @@ void Update()
|
|||||||
|
|
||||||
MoveCamera();
|
MoveCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void MoveCamera()
|
private void MoveCamera()
|
||||||
{
|
{
|
||||||
mainCamera.transform.position = new Vector3(transform.position.x, transform.position.y,-10);
|
mainCamera.transform.position = new Vector3(transform.position.x, transform.position.y,-10);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatReturn GetStats()
|
public StatReturn GetStats()
|
||||||
{
|
{
|
||||||
var stats = new StatReturn
|
var stats = new StatReturn
|
||||||
@ -76,14 +70,24 @@ public StatReturn GetStats()
|
|||||||
};
|
};
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyDamage(float damage)
|
public void ApplyDamage(float damage)
|
||||||
{
|
{
|
||||||
health -= damage;
|
health -= damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetHealth()
|
public float GetHealth()
|
||||||
{
|
{
|
||||||
return health;
|
return health;
|
||||||
}
|
}
|
||||||
|
public float GetDamage()
|
||||||
|
{
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
public void SetHealth(float newHealth)
|
||||||
|
{
|
||||||
|
health = newHealth;
|
||||||
|
}
|
||||||
|
public void SetDamage(float newDamage)
|
||||||
|
{
|
||||||
|
damage = newDamage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,9 @@ public class Gameplay : MonoBehaviour
|
|||||||
[SerializeField] private GameObject overMind;
|
[SerializeField] private GameObject overMind;
|
||||||
[SerializeField] private float timeOnStart;
|
[SerializeField] private float timeOnStart;
|
||||||
[SerializeField] private GameObject DeathScreen;
|
[SerializeField] private GameObject DeathScreen;
|
||||||
|
|
||||||
|
[SerializeField] private float balanceScale;
|
||||||
|
|
||||||
private float _time;
|
private float _time;
|
||||||
private GameStates _curGameState;
|
private GameStates _curGameState;
|
||||||
public enum GameStates
|
public enum GameStates
|
||||||
@ -23,6 +26,23 @@ void Start()
|
|||||||
_curGameState = GameStates.Game;
|
_curGameState = GameStates.Game;
|
||||||
_time = timeOnStart;
|
_time = timeOnStart;
|
||||||
_characterCharacterClass = character.GetComponent<Character>();
|
_characterCharacterClass = character.GetComponent<Character>();
|
||||||
|
StartCoroutine(AutoBalance());
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator AutoBalance()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(30f);
|
||||||
|
print("autobalance");
|
||||||
|
if (balanceScale > 1.1f)
|
||||||
|
{
|
||||||
|
balanceScale -= 0.1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_characterCharacterClass.SetHealth(_characterCharacterClass.GetHealth() * balanceScale);
|
||||||
|
_characterCharacterClass.SetDamage(_characterCharacterClass.GetDamage() * balanceScale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
@ -49,7 +69,7 @@ public float GetTimer()
|
|||||||
{
|
{
|
||||||
return _time;
|
return _time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTime(float addedTime)
|
public void AddTime(float addedTime)
|
||||||
{
|
{
|
||||||
_time += addedTime;
|
_time += addedTime;
|
||||||
|
Loading…
Reference in New Issue
Block a user