Skip to content

Commit

Permalink
Merge pull request #3 from nicoco007/0.12.0-fixes
Browse files Browse the repository at this point in the history
0.12.0p1 Fixes
  • Loading branch information
PureDark authored Nov 30, 2018
2 parents b5d688a + e47436b commit ba77a5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
19 changes: 11 additions & 8 deletions TransparentWall/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Plugin : IEnhancedPlugin, IPlugin
public string Version => VersionNum;
public string[] Filter { get; }

private static AsyncScenesLoader loader;
private GameScenesManager _scenesManager;

public const string KeyTranparentWall = "TransparentWall";
public const string KeyHMD = "HMD";
Expand Down Expand Up @@ -113,19 +113,22 @@ public void OnApplicationQuit()

private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
{
if (scene.name == "StandardLevelLoader")
if (_scenesManager == null)
{
if (!loader)
loader = Resources.FindObjectsOfTypeAll<AsyncScenesLoader>().FirstOrDefault();
loader.loadingDidFinishEvent += OnLoadingDidFinish;
_scenesManager = Resources.FindObjectsOfTypeAll<GameScenesManager>().FirstOrDefault();

if (_scenesManager != null)
_scenesManager.transitionDidFinishEvent += SceneTransitionDidFinish;
}
}
public void OnLoadingDidFinish()

private void SceneTransitionDidFinish()
{
new GameObject("TransparentWall").AddComponent<TransparentWall>();
if (SceneManager.GetActiveScene().name == "GameCore")
new GameObject("TransparentWall").AddComponent<TransparentWall>();
}

public void OnLateUpdate()
public void OnLateUpdate()
{
}

Expand Down
5 changes: 3 additions & 2 deletions TransparentWall/TransparentWall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ private IEnumerator<WaitForEndOfFrame> setupCamerasCoroutine()
{
yield return new WaitForEndOfFrame();

var mainGameSceneSetupData = Resources.FindObjectsOfTypeAll<MainGameSceneSetupData>().FirstOrDefault();
StandardLevelSceneSetupDataSO levelSetup = Resources.FindObjectsOfTypeAll<StandardLevelSceneSetupDataSO>().FirstOrDefault();

Camera mainCamera = FindObjectsOfType<Camera>().FirstOrDefault(x => x.CompareTag("MainCamera"));
if (Plugin.IsHMDOn && !mainGameSceneSetupData.gameplayOptions.validForScoreUse)

if (Plugin.IsHMDOn && levelSetup.gameplayCoreSetupData.gameplayModifiers.noFail)
mainCamera.cullingMask &= ~(1 << WallLayer);
else
mainCamera.cullingMask |= (1 << WallLayer);
Expand Down

0 comments on commit ba77a5d

Please sign in to comment.