mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix conditional object activation making everything viewable when loading
This commit is contained in:
parent
0f56b59d63
commit
c998a92cec
@ -6,6 +6,8 @@ namespace NewHorizons.Components.Props
|
||||
{
|
||||
public class ConditionalObjectActivation : MonoBehaviour
|
||||
{
|
||||
private bool _playerAwake, _playerDoneAwake;
|
||||
|
||||
public GameObject GameObject;
|
||||
public string DialogueCondition;
|
||||
public bool CloseEyes;
|
||||
@ -47,6 +49,7 @@ namespace NewHorizons.Components.Props
|
||||
GlobalMessenger<string, bool>.AddListener("DialogueConditionChanged", OnDialogueConditionChanged);
|
||||
GlobalMessenger.AddListener("ExitConversation", OnExitConversation);
|
||||
GlobalMessenger.AddListener("EnterConversation", OnEnterConversation);
|
||||
GlobalMessenger.AddListener("WakeUp", OnWakeUp);
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
@ -54,6 +57,23 @@ namespace NewHorizons.Components.Props
|
||||
GlobalMessenger<string, bool>.RemoveListener("DialogueConditionChanged", OnDialogueConditionChanged);
|
||||
GlobalMessenger.RemoveListener("ExitConversation", OnExitConversation);
|
||||
GlobalMessenger.RemoveListener("EnterConversation", OnEnterConversation);
|
||||
GlobalMessenger.RemoveListener("WakeUp", OnWakeUp);
|
||||
}
|
||||
|
||||
private void OnWakeUp()
|
||||
{
|
||||
_playerAwake = true;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (!_playerDoneAwake && _playerAwake)
|
||||
{
|
||||
if (!_playerCameraEffectController._isOpeningEyes)
|
||||
{
|
||||
_playerDoneAwake = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnExitConversation()
|
||||
@ -88,7 +108,7 @@ namespace NewHorizons.Components.Props
|
||||
|
||||
public void SetActive(bool active)
|
||||
{
|
||||
if (CloseEyes)
|
||||
if (CloseEyes && _playerDoneAwake)
|
||||
{
|
||||
Delay.StartCoroutine(Coroutine(active));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user