Spawn adventurers when fade is at midpoint
Also adds the character prefabs
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user