Spawn adventurers when fade is at midpoint

Also adds the character prefabs
This commit is contained in:
2023-07-09 11:42:15 +02:00
parent dbb44e6b6f
commit 3a01324d13
3 changed files with 348 additions and 691 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@@ -13,6 +14,7 @@ public class GameManager : MonoBehaviour
private float m_fadeTotal; private float m_fadeTotal;
[SerializeField] private bool m_showFade = false; [SerializeField] private bool m_showFade = false;
[SerializeField] private float m_fadeDuration = 1; [SerializeField] private float m_fadeDuration = 1;
private Action m_fadeCallback;
private void Awake() private void Awake()
{ {
@@ -36,6 +38,8 @@ public class GameManager : MonoBehaviour
m_fadeT += Time.deltaTime; m_fadeT += Time.deltaTime;
} else } else
{ {
m_fadeCallback?.Invoke();
m_fadeCallback = null;
m_fadeT -= Time.deltaTime; m_fadeT -= Time.deltaTime;
} }
m_fadeTotal += Time.deltaTime; m_fadeTotal += Time.deltaTime;
@@ -55,8 +59,9 @@ public class GameManager : MonoBehaviour
} }
public void FadePingPong() public void FadePingPong(Action callback = null)
{ {
m_fadeCallback = callback;
m_fadeTotal = 0; m_fadeTotal = 0;
m_showFade = true; m_showFade = true;
} }

View File

@@ -60,6 +60,17 @@ public class QuestManager : MonoBehaviour
return true; return true;
} }
public void SpawnAdventurers()
{
foreach (var adventurer in Resources.FindObjectsOfTypeAll<AdventurerInteractable>())
{
if (adventurer.m_spawnQuestID == activeQuest)
{
adventurer.gameObject.SetActive(true);
}
}
}
public void NextQuest() public void NextQuest()
{ {
activeQuest++; activeQuest++;
@@ -68,14 +79,8 @@ public class QuestManager : MonoBehaviour
Debug.Log("All quests completed"); Debug.Log("All quests completed");
} }
foreach (var adventurer in Resources.FindObjectsOfTypeAll<AdventurerInteractable>())
{ GameManager.Instance.FadePingPong(SpawnAdventurers);
if (adventurer.m_spawnQuestID == activeQuest)
{
adventurer.gameObject.SetActive(true);
}
}
GameManager.Instance.FadePingPong();
} }
public void RetryQuest() public void RetryQuest()