final commit?
This commit is contained in:
parent
0e2a7cc7c3
commit
3f53e2caa8
59 changed files with 3989 additions and 1668 deletions
|
|
@ -35,7 +35,7 @@ public class WaveManager : MonoBehaviour
|
|||
public Texture bossName;
|
||||
//public DialogueScript bossDialogue;
|
||||
}
|
||||
|
||||
public GameObject pauseMenu;
|
||||
[Header("Player Point")]
|
||||
public Player player; //only for continues lol
|
||||
[SerializeField] private Transform tlPoint;
|
||||
|
|
@ -52,7 +52,7 @@ public class WaveManager : MonoBehaviour
|
|||
public Enemy bossInstance;
|
||||
public GameObject bossUI;
|
||||
[SerializeField] private RawImage bossNameUI;
|
||||
[SerializeField] private Transform bossHPBar;
|
||||
[SerializeField] private Image bossHPBar;
|
||||
|
||||
[Header("Final Boss")]
|
||||
[SerializeField] private Prismriver lunasa;
|
||||
|
|
@ -69,25 +69,41 @@ public class WaveManager : MonoBehaviour
|
|||
public List<Enemy> enemiesInPlay = new();
|
||||
[SerializeField] private float enemyCheckRadius;
|
||||
[SerializeField] private LayerMask enemyLayer;
|
||||
public int healInterval;
|
||||
[Header("Audio")]
|
||||
public AudioClip bossDialogueLoop;
|
||||
public AudioClip bossMusic;
|
||||
public float bossVolume;
|
||||
public AudioClip finalDialogueLoop;
|
||||
public AudioClip finalMusic;
|
||||
public float finalVolume;
|
||||
public AudioSource audioSource;
|
||||
public AudioSource musicSource;
|
||||
[SerializeField] private AudioClip musicIntro;
|
||||
public AudioClip musicLoop;
|
||||
public float musicVolume;
|
||||
[Header("UI")]
|
||||
public GameObject loseUI;
|
||||
public StatsUI statsUI;
|
||||
[Header("Endless")]
|
||||
[SerializeField] private Enemy[] enemyList;
|
||||
[SerializeField] private Enemy[] bossList;
|
||||
[SerializeField] private int bossWaveInterval;
|
||||
[Header("Enemy Count Calculations")]
|
||||
[SerializeField] private float baseSpawnAmount;
|
||||
[SerializeField] private float exponentIncrease;
|
||||
public float exponentHealthIncrease;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
SpawnWave();
|
||||
if (GameManager.instance.isEndless)
|
||||
{
|
||||
SpawnEndlessWave();
|
||||
}
|
||||
else
|
||||
{
|
||||
SpawnWave();
|
||||
}
|
||||
//SpawnFinalBoss();
|
||||
musicSource.volume = musicVolume;
|
||||
musicSource.PlayOneShot(musicIntro, musicVolume);
|
||||
musicSource.PlayOneShot(musicIntro);
|
||||
StartCoroutine(WaitForLoop());
|
||||
}
|
||||
|
||||
|
|
@ -115,6 +131,25 @@ public class WaveManager : MonoBehaviour
|
|||
return randomPoint;
|
||||
}
|
||||
|
||||
public void CallPauseMenu()
|
||||
{
|
||||
GameManager.instance.SetPauseMenu();
|
||||
}
|
||||
public void CallExitGame()
|
||||
{
|
||||
GameManager.instance.ExitGame();
|
||||
}
|
||||
|
||||
public void CallRestartGame()
|
||||
{
|
||||
GameManager.instance.RestartGame();
|
||||
}
|
||||
|
||||
public void CallContinue()
|
||||
{
|
||||
GameManager.instance.ContinueGame();
|
||||
}
|
||||
|
||||
private bool CheckEnemyOverlap(Vector3 areaToCheck)
|
||||
{
|
||||
if (Physics2D.OverlapCircle(areaToCheck, enemyCheckRadius, enemyLayer))
|
||||
|
|
@ -142,6 +177,20 @@ public class WaveManager : MonoBehaviour
|
|||
}
|
||||
wave++;
|
||||
}
|
||||
private void SpawnEndlessWave()
|
||||
{
|
||||
//waveUI.text = $"Wave: {wave}";
|
||||
int amountToSpawn = Mathf.FloorToInt(baseSpawnAmount * Mathf.Pow(wave, exponentIncrease));
|
||||
for (int i = 0; i < amountToSpawn; i++)
|
||||
{
|
||||
SpawnEnemy(enemyList[Random.Range(0, enemyList.Length)]);
|
||||
}
|
||||
if (wave % bossWaveInterval == 0)
|
||||
{
|
||||
SpawnBoss(bossList[Random.Range(0, bossList.Length)]);
|
||||
}
|
||||
wave++;
|
||||
}
|
||||
|
||||
protected void SpawnBoss(Enemy boss)
|
||||
{
|
||||
|
|
@ -150,8 +199,16 @@ public class WaveManager : MonoBehaviour
|
|||
bossNameUI.texture = waveList[wave - 1].bossName;
|
||||
bossNameUI.SetNativeSize();
|
||||
UpdateBossUI();
|
||||
player.isStalled = true; //wait for boss to enter then start dialogue
|
||||
player.invulnerable = true;
|
||||
if (!GameManager.instance.isEndless)
|
||||
{
|
||||
player.isStalled = true; //wait for boss to enter then start dialogue
|
||||
player.invulnerable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
newBoss.maxHealth = Mathf.FloorToInt(newBoss.maxHealth * Mathf.Pow(wave, exponentHealthIncrease));
|
||||
newBoss.health = newBoss.maxHealth;
|
||||
}
|
||||
}
|
||||
private void SpawnFinalBoss()
|
||||
{
|
||||
|
|
@ -171,6 +228,11 @@ public class WaveManager : MonoBehaviour
|
|||
{
|
||||
Enemy newEnemy = Instantiate(enemy, enemyFolder);
|
||||
Vector3 movepos = GetRandomEnemyPoint();
|
||||
if (GameManager.instance.isEndless)
|
||||
{
|
||||
newEnemy.maxHealth = Mathf.FloorToInt(newEnemy.maxHealth * Mathf.Pow(wave, exponentHealthIncrease));
|
||||
newEnemy.health = newEnemy.maxHealth;
|
||||
}
|
||||
newEnemy.currentMovementRoutine = newEnemy.StartCoroutine(newEnemy.MoveToPosition(enemySpawnPoint.position,movepos, newEnemy.moveSpeed));
|
||||
newEnemy.originalPosition = movepos;
|
||||
enemiesInPlay.Add(newEnemy);
|
||||
|
|
@ -195,18 +257,26 @@ public class WaveManager : MonoBehaviour
|
|||
{
|
||||
if (lyricaInstance)
|
||||
{
|
||||
bossHPBar.localScale = new Vector3(1 - (float)prismHP / prismMaxHP, 1f, 1f);
|
||||
bossHPBar.fillAmount = 1 - (float)prismHP / prismMaxHP;
|
||||
return;
|
||||
}
|
||||
bossHPBar.localScale = new Vector3(1 - (float)bossInstance.health / bossInstance.maxHealth, 1f, 1f);
|
||||
bossHPBar.fillAmount = 1 - (float)bossInstance.health / bossInstance.maxHealth;
|
||||
}
|
||||
|
||||
public virtual void UpdateKills()
|
||||
{
|
||||
if (enemiesInPlay.Count == 0)
|
||||
{
|
||||
if (waveList[wave - 1].bossEnemy)
|
||||
Debug.Log("interval: " + ((wave+1) % healInterval));
|
||||
if ((wave + 1) % healInterval == 0)
|
||||
{
|
||||
Debug.Log("here");
|
||||
player.Heal(1);
|
||||
}
|
||||
if (GameManager.instance.isEndless)
|
||||
{
|
||||
SpawnEndlessWave();
|
||||
return;
|
||||
}
|
||||
SpawnWave();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue