private void GameManagerOnEnterHero(On.GameManager.orig_EnterHero orig, GameManager self, bool additivegatesearch) { scene = self.sceneName; Modding.Logger.Log("NAME " + self.sceneName); if (self.sceneName == "GG_Atrium") { CreateGateway("right test", new Vector2(115f, 60.6f), new Vector2(1f, 4f), "NewRoom", "left test", true, false, GameManager.SceneLoadVisualizations.Default); } else if (self.sceneName == "NewRoom") { Modding.Logger.Log("MADE1"); CreateGateway("left test", new Vector2(0.5f, 6f), new Vector2(1f, 4f), "GG_Atrium", "right test", false, true, GameManager.SceneLoadVisualizations.Default); Modding.Logger.Log("MADE1"); } orig(self, additivegatesearch); }
private void GameManager_EnterHero(On.GameManager.orig_EnterHero orig, GameManager self, bool additiveGateSearch) { Log("EnterHero"); self.UpdateSceneName(); if (self.sceneName == "ModScene1") { sceneName = "ModScene1"; //From custome scene to Tutorial_01 CreateGateway("left custScene", new Vector2(-1f, 1.1f), new Vector2(1f, 4f), "Tutorial_01", "left test", true, false, false, GameManager.SceneLoadVisualizations.Default); orig(self, false); return; } else if (self.sceneName == "Tutorial_01") { Log("Detect Tutorial 01"); sceneName = "Tutorial_01"; CreateGateway("left test", new Vector2(163.6f, 63.4f), new Vector2(1f, 4f), "ModScene1", "left custScene", false, true, false, GameManager.SceneLoadVisualizations.GodsAndGlory); Log("Created Gate Detected"); orig(self, false); return; } orig(self, additiveGateSearch); }
private void GameManager_EnterHero(On.GameManager.orig_EnterHero orig, GameManager self, bool additiveGateSearch) { self.UpdateSceneName(); if (self.sceneName == "zombie-scene") { foreach (var i in FindObjectsOfType <AudioSource>().Where(x => x.name == "Main")) { Destroy(i); } sceneName = "zombie-scene"; CreateGateway("left test2", new Vector2(42.7f, 3.8f), new Vector2(1f, 4f), "GG_Workshop", "left test", false, true, false, GameManager.SceneLoadVisualizations.Default); CreateGateway("right test3", new Vector2(146.8f, 3.8f), new Vector2(2.4f, 5.2f), "zombie-scene2", "left test3", true, false, true, GameManager.SceneLoadVisualizations.Default); orig(self, false); StartCoroutine(DoorControl()); StartCoroutine(CameraControl()); return; } else if (self.sceneName == "zombie-scene2") { sceneName = "zombie-scene2"; CreateGateway("left test3", new Vector2(89.45f, 4.3f), new Vector2(1f, 4f), "zombie-scene", "right test3", false, true, false, GameManager.SceneLoadVisualizations.Default); Log("made gateway"); orig(self, false); StartCoroutine(CameraControl2()); return; } else if (self.sceneName == "GG_Workshop") { if (ab == null) { ab = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "zombiebundle")); ab3 = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "zombiebundle2")); ab2 = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "zombscene")); ab4 = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "zombscene2")); GameObject _aud = new GameObject(); var f = _aud.AddComponent <AudioSource>(); f.loop = true; f.clip = ab.LoadAsset <AudioClip>("audMusic"); _aud.AddComponent <MusicControl>(); DontDestroyOnLoad(_aud); foreach (AudioClip i in ab.LoadAllAssets <AudioClip>()) { clips.Add(i.name, i); } } sceneName = "GG_Workshop"; CreateGateway("left test", new Vector2(7.6f, 36.4f), new Vector2(1f, 4f), "zombie-scene", "left test2", false, true, false, GameManager.SceneLoadVisualizations.Default); orig(self, false); return; } orig(self, additiveGateSearch); }
private static void OnEnterHero(On.GameManager.orig_EnterHero orig, GameManager self, bool additivegatesearch) { self.UpdateSceneName(); if (self.sceneName != "White_Palace_20") { orig(self, additivegatesearch); return; } var go = new GameObject(DOOR_NAME); var tp = go.AddComponent <TransitionPoint>(); tp.respawnMarker = go.AddComponent <HazardRespawnMarker>(); tp.isADoor = true; tp.name = DOOR_NAME; go.transform.position = new Vector3(228.4f, 165.3f); orig(self, false); }
private void GetLoadEnd(On.GameManager.orig_EnterHero orig, GameManager self, bool additiveGateSearch) { bool hazardRespawn; try { hazardRespawn = (bool)typeof(GameManager).GetField("hazardRespawningHero", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(GameManager.instance); } catch (Exception e) { LogError("Unable to read hazard respawn bool:\n" + e); hazardRespawn = false; } if (!hazardRespawn) { Log(lastSceneLoaded, Time.realtimeSinceStartup - lastSceneLoadStart); GameManager.instance.StartCoroutine(WaitForNormalizedLoad(lastSceneLoaded, () => orig(self, additiveGateSearch))); } else { orig(self, additiveGateSearch); } }
private void OnEnterHero(On.GameManager.orig_EnterHero orig, GameManager gm, bool additiveGateSearch) { gm.UpdateSceneName(); if (gm.sceneName == "FloralFury") { On.GameManager.RefreshTilemapInfo += OnRefreshTileMapInfo; On.HeroController.CanDoubleJump += DisableDoubleJump; On.HeroController.CanWallJump += DisableWallJump; On.HeroController.CanWallSlide += DisableWallSlide; SceneController = Instantiate(CagneyCarnation.GameObjects["BSC"]); SceneController.SetActive(true); ArenaFinder.BossLevel = SceneController.GetComponent <BossSceneController>().BossLevel; HeroController.instance.heroLight.sprite = null; HeroController.instance.vignette.sprite = null; GameObject scenery = GameObject.Find("_Scenery"); foreach (SpriteRenderer sr in scenery.GetComponentsInChildren <SpriteRenderer>(true)) { sr.material.shader = Shader.Find("Sprites/Default"); } GameObject flower = Instantiate(CagneyCarnation.GameObjects["Flower"], new Vector2(56.5f, 22f), Quaternion.identity); flower.AddComponent <Flower>(); GameObject platforms = GameObject.Find("Platforms"); foreach (tk2dSprite sprite in platforms.GetComponentsInChildren <tk2dSprite>(true)) { foreach (tk2dSpriteDefinition spriteDef in sprite.Collection.spriteDefinitions) { spriteDef.material.shader = Shader.Find("Sprites/Default-ColorFlash"); } } orig(gm, false); HeroController.instance.transform.SetPosition2D(47f, 23.3f); StartCoroutine(CameraControl()); return; } if (gm.sceneName == "GG_Workshop") { if (_bundle == null) { _bundle = CagneyCarnation.Bundles[CagneyCarnation.ArenaAssetsPath]; } GameCameras.instance.tk2dCam.ZoomFactor = 1; On.GameManager.RefreshTilemapInfo -= OnRefreshTileMapInfo; On.HeroController.CanDoubleJump -= DisableDoubleJump; On.HeroController.CanWallJump -= DisableWallJump; On.HeroController.CanWallSlide -= DisableWallSlide; orig(gm, false); return; } orig(gm, additiveGateSearch); }