Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using PlinioJRM.Utils;
- using UnityEngine;
- namespace PlinioJRM.Systems.Waves {
- public class WaveController : MonoBehaviour {
- [SerializeField]
- private float _waveDuration = 15f;
- [SerializeField]
- private float _waveInterval = 3f;
- [SerializeField]
- private List<EnemySpawnScore> _enemyScores;
- private CountdownTimer _waveTimer;
- private CountdownTimer _waveIntervalTimer;
- #region Unity Callbacks
- private void Start() {
- _waveTimer = new CountdownTimer(_waveDuration);
- _waveIntervalTimer = new CountdownTimer(_waveInterval);
- }
- private void Update() {
- void UpdateTimers() {
- float deltatime = Time.deltaTime;
- _waveTimer.Tick(deltatime);
- _waveIntervalTimer.Tick(deltatime);
- }
- UpdateTimers();
- }
- private void OnEnable() {
- _waveTimer.OnEachSecond += WaveTimerOnOnEachSecond;
- _waveTimer.OnStop += WaveTimerOnOnStop;
- _waveIntervalTimer.OnStop += WaveIntervalTimerOnOnStop;
- }
- private void OnDisable() {
- _waveTimer.OnEachSecond -= WaveTimerOnOnEachSecond;
- _waveTimer.OnStop -= WaveTimerOnOnStop;
- _waveIntervalTimer.OnStop -= WaveIntervalTimerOnOnStop;
- }
- #endregion
- private void WaveTimerOnOnEachSecond() {
- throw new NotImplementedException();
- }
- private void WaveTimerOnOnStop() {
- _waveIntervalTimer.Start();
- }
- private void WaveIntervalTimerOnOnStop() {
- _waveTimer.Start();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement