
Added a Score to the Game Added an actual blackhole material and shader to the black hole Added a new Main menu and How to Play menu system Added Beam swords to all ships (replacing the light saber things the player had) Added a pause menu Overhauled the UI for the game scene Added List to hold the amount of core energy needed for each level Added the URP package for better rendering (apparently) Added a GameState enum to set which part of the game the player is in Added Magnet powerup to game Changed the way powerups are spawned, enemies now have a loot table Changed cores to core energy which is a percentage needed to pass a level Changed all the Ints to Hidden Value ints to maybe stop cheat engine users finding the important values Changed all level loads to use sceneloadasync Updated all of the materials to use URP shaders Removed Junk Files from external sources Rearranged the folders inside the unity project to try and reduce some name length issues
108 lines
1.9 KiB
C#
108 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
public enum TimerDirection
|
|
{
|
|
TimerIncrement,
|
|
TimerDecrement
|
|
}
|
|
|
|
public class TimerHelper
|
|
{
|
|
private float _timerInterval;
|
|
private float _timerMax;
|
|
private float _timerTick;
|
|
|
|
private int _timesRun;
|
|
|
|
private bool _timerRepeats;
|
|
|
|
private bool _hasBeedStarted = false;
|
|
|
|
private TimerDirection _timerDirection;
|
|
|
|
public TimerHelper(float timeMax, bool repeating = true, TimerDirection direction = TimerDirection.TimerIncrement)
|
|
{
|
|
_timerMax = timeMax;
|
|
_timerRepeats = repeating;
|
|
_timerDirection = direction;
|
|
|
|
if (_timerDirection == TimerDirection.TimerDecrement)
|
|
{
|
|
_timerInterval = 0.0f;
|
|
_timerTick = -_timerMax;
|
|
}
|
|
else
|
|
{
|
|
_timerInterval = _timerMax;
|
|
_timerTick = 0.0f;
|
|
}
|
|
}
|
|
|
|
public float CurrentTick
|
|
{
|
|
get
|
|
{
|
|
return Math.Abs(_timerTick);
|
|
}
|
|
}
|
|
|
|
public int TimesRun
|
|
{
|
|
get
|
|
{
|
|
return _timesRun;
|
|
}
|
|
}
|
|
|
|
public float Position
|
|
{
|
|
get
|
|
{
|
|
return Math.Abs(_timerTick) / _timerMax;
|
|
}
|
|
}
|
|
|
|
public bool Started
|
|
{
|
|
get
|
|
{
|
|
return _hasBeedStarted;
|
|
}
|
|
}
|
|
|
|
public bool HasTicked(float currentTimestamp)
|
|
{
|
|
_hasBeedStarted = true;
|
|
if (_timerTick >= _timerInterval)
|
|
{
|
|
_timesRun++;
|
|
if (_timerRepeats)
|
|
{
|
|
RestartTimer();
|
|
}
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
_timerTick += currentTimestamp;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public void RestartTimer()
|
|
{
|
|
if (_timerDirection == TimerDirection.TimerDecrement)
|
|
{
|
|
_timerTick = -_timerMax;
|
|
}
|
|
else
|
|
{
|
|
_timerTick = 0.0f;
|
|
}
|
|
_hasBeedStarted = false;
|
|
}
|
|
|
|
}
|
|
|