private void KillPlayer() { if (!isDead) { isDead = true; render.sprite = pFrames[curCharacter][0]; body.rotation = render.flipX ? -90f : 90f; render.color = Color.red; CentralUIController.singleton.deathScreen.SetActive(true); foreach (Enemy obj in GameObject.FindObjectsOfType <Enemy>()) { Destroy(obj); } movement = Vector2.zero; if (!SaveManager.saveData.isEasyMode) { SaveManager.saveData.deathCount++; if (SaveManager.saveData.deathCount == 100) { AchievementManager.Achieve("die_100_times"); } SaveManager.SaveData(); } SfxController.singleton.damageEntity.Play(); TimerController.StopTimer(); Destroy(this); } }
protected virtual void Kill() { MapController.singleton.enemies--; if (!SaveManager.saveData.isEasyMode) { SaveManager.saveData.enemyKillCount++; if (SaveManager.saveData.enemyKillCount == 100) { AchievementManager.Achieve("kill_100_enemies"); } } // Boss stage if (SceneManager.GetActiveScene().buildIndex == 13 && MapController.singleton.enemies != 0) { LeagueOfLegendController.singleton.SpawnEnemyPotion(gameObject.transform.position); } }
private void Start() { TimerController.StopTimer(); long time = TimerController.GetTime(); if (!SaveManager.saveData.isEasyMode) { if (time < SaveManager.saveData.fastestTime || SaveManager.saveData.fastestTime == -1) { SaveManager.saveData.fastestTime = time; SaveManager.SaveData(); } AchievementManager.Achieve("beat_the_game"); } forXan.SetInvisible(); foreach (Text t in forXan.GetComponentsInChildren <Text>()) { t.SetInvisible(); } foreach (Text t in title.GetComponentsInChildren <Text>()) { t.SetInvisible(); } foreach (Text text in children) { text.SetInvisible(); foreach (Text t in text.GetComponentsInChildren <Text>()) { t.SetInvisible(); } } continueButton.image.SetInvisible(); continueButton.onClick.AddListener(delegate { SfxController.singleton.buttonClick.Play(); }); Timing.RunCoroutine(Fade().CancelWith(gameObject)); }
public void PlayGame() { SceneManager.LoadScene(3); AchievementManager.Achieve("play_the_game"); Destroy(MenuMusicController.instance.gameObject); }
private static bool Prefix(CharacterClassManager __instance, bool lite = false, bool escape = false) { Role role = __instance.Classes.SafeGet(__instance.CurClass); if (!__instance._wasAnytimeAlive && __instance.CurClass != RoleType.Spectator && __instance.CurClass != RoleType.None) { __instance._wasAnytimeAlive = true; } __instance.InitSCPs(); __instance.AliveTime = 0f; switch (role.team) { case Team.MTF: AchievementManager.Achieve("arescue"); break; case Team.CHI: AchievementManager.Achieve("chaos"); break; case Team.RSC: case Team.CDP: __instance.EscapeStartTime = (int)Time.realtimeSinceStartup; break; } __instance.GetComponent <Inventory>(); try { __instance.GetComponent <FootstepSync>().SetLoudness(role.team, role.roleId.Is939()); } catch { } if (NetworkServer.active) { Handcuffs component = __instance.GetComponent <Handcuffs>(); component.ClearTarget(); component.NetworkCufferId = -1; } if (role.team != Team.RIP) { if (NetworkServer.active && !lite) { Vector3 constantRespawnPoint = NonFacilityCompatibility.currentSceneSettings.constantRespawnPoint; if (constantRespawnPoint != Vector3.zero) { __instance._pms.OnPlayerClassChange(constantRespawnPoint, 0f); } else { GameObject randomPosition = CharacterClassManager._spawnpointManager.GetRandomPosition(__instance.CurClass); Vector3 spawnPoint; float rotY; if (randomPosition != null) { spawnPoint = randomPosition.transform.position; rotY = randomPosition.transform.rotation.eulerAngles.y; AmmoBox component1 = __instance.GetComponent <AmmoBox>(); if (escape && __instance.KeepItemsAfterEscaping) { Inventory component2 = PlayerManager.localPlayer.GetComponent <Inventory>(); for (ushort index = 0; index < 3; ++index) { if (component1[index] >= 15U) { component2.SetPickup(component1.types[index].inventoryID, component1[index], randomPosition.transform.position, randomPosition.transform.rotation, 0, 0, 0); } } } component1.ResetAmmo(); } else { spawnPoint = __instance.DeathPosition; rotY = 0f; } var ev = new SpawningEventArgs(API.Features.Player.Get(__instance.gameObject), __instance.CurClass, spawnPoint, rotY); Player.OnSpawning(ev); __instance._pms.OnPlayerClassChange(ev.Position, ev.RotationY); } if (!__instance.SpawnProtected && __instance.EnableSP && __instance.SProtectedTeam.Contains((int)role.team)) { __instance.GodMode = true; __instance.SpawnProtected = true; __instance.ProtectedTime = Time.time; } } if (!__instance.isLocalPlayer) { __instance.GetComponent <PlayerStats>().maxHP = role.maxHP; } } __instance.Scp0492.iAm049_2 = __instance.CurClass == RoleType.Scp0492; __instance.Scp106.iAm106 = __instance.CurClass == RoleType.Scp106; __instance.Scp173.iAm173 = __instance.CurClass == RoleType.Scp173; __instance.Scp939.iAm939 = __instance.CurClass.Is939(); __instance.RefreshPlyModel(); return(false); }
public static bool Prefix(CharacterClassManager __instance, bool lite = false, bool escape = false) { if (EventPlugin.PlayerSpawnEventPatchDisable) { return(true); } try { Role role = __instance.Classes.SafeGet(__instance.CurClass); if (!__instance._wasAnytimeAlive && __instance.CurClass != RoleType.Spectator && __instance.CurClass != RoleType.None) { __instance._wasAnytimeAlive = true; } __instance.InitSCPs(); __instance.AliveTime = 0f; switch (role.team) { case Team.MTF: AchievementManager.Achieve("arescue"); break; case Team.CHI: AchievementManager.Achieve("chaos"); break; case Team.RSC: case Team.CDP: __instance.EscapeStartTime = (int)Time.realtimeSinceStartup; break; } __instance.GetComponent <Inventory>(); try { __instance.GetComponent <FootstepSync>().SetLoudness(role.team, role.roleId.Is939()); } catch { } if (NetworkServer.active) { Handcuffs component = __instance.GetComponent <Handcuffs>(); component.ClearTarget(); component.NetworkCufferId = -1; } if (role.team != Team.RIP) { if (NetworkServer.active && !lite) { Vector3 constantRespawnPoint = NonFacilityCompatibility.currentSceneSettings.constantRespawnPoint; if (constantRespawnPoint != Vector3.zero) { __instance._pms.OnPlayerClassChange(constantRespawnPoint, 0f); } else { GameObject randomPosition = CharacterClassManager.SpawnpointManager.GetRandomPosition(__instance.CurClass); Vector3 spawnPoint = new Vector3(0f, 0f, 0f); float rotY = 0f; if (randomPosition != null) { spawnPoint = randomPosition.transform.position; rotY = randomPosition.transform.rotation.eulerAngles.y; AmmoBox component2 = __instance.GetComponent <AmmoBox>(); if (escape && __instance.KeepItemsAfterEscaping) { Inventory component3 = PlayerManager.localPlayer.GetComponent <Inventory>(); for (ushort num = 0; num < 3; num += 1) { if (component2.GetAmmo(num) >= 15) { component3.SetPickup(component2.types[num].inventoryID, component2.GetAmmo(num), randomPosition.transform.position, randomPosition.transform.rotation, 0, 0, 0); } } } component2.SetAmmoAmount(); } else { spawnPoint = __instance.DeathPosition; rotY = 0f; } Events.InvokePlayerSpawn(__instance, __instance.CurClass, ref spawnPoint, ref rotY); __instance._pms.OnPlayerClassChange(spawnPoint, rotY); } if (!__instance.SpawnProtected && __instance.EnableSP && __instance.SProtectedTeam.Contains((int)role.team)) { __instance.GodMode = true; __instance.SpawnProtected = true; __instance.ProtectedTime = Time.time; } } if (!__instance.isLocalPlayer) { __instance.GetComponent <PlayerStats>().maxHP = role.maxHP; } } __instance.Scp049.iAm049 = (__instance.CurClass == RoleType.Scp049); __instance.Scp0492.iAm049_2 = (__instance.CurClass == RoleType.Scp0492); __instance.Scp096.iAm096 = (__instance.CurClass == RoleType.Scp096); __instance.Scp106.iAm106 = (__instance.CurClass == RoleType.Scp106); __instance.Scp173.iAm173 = (__instance.CurClass == RoleType.Scp173); __instance.Scp939.iAm939 = __instance.CurClass.Is939(); __instance.RefreshPlyModel(); return(false); } catch (Exception exception) { Log.Error($"PlayerSpawnEvent error: {exception}"); return(true); } }
public static void ApplyPropertiesCustom(this ReferenceHub rh, Vector3 pos, float rotY, bool lite = false) { Role role = rh.characterClassManager.Classes.SafeGet(rh.characterClassManager.CurClass); if (!rh.characterClassManager._wasAnytimeAlive && rh.characterClassManager.CurClass != RoleType.Spectator && rh.characterClassManager.CurClass != RoleType.None) { rh.characterClassManager._wasAnytimeAlive = true; } rh.characterClassManager.InitSCPs(); rh.characterClassManager.AliveTime = 0.0f; switch (role.team) { case Team.MTF: AchievementManager.Achieve("arescue", true); break; case Team.CHI: AchievementManager.Achieve("chaos", true); break; case Team.RSC: case Team.CDP: rh.characterClassManager.EscapeStartTime = (int)Time.realtimeSinceStartup; break; } rh.characterClassManager.GetComponent <Inventory>(); try { rh.characterClassManager.GetComponent <FootstepSync>().SetLoudness(role.team, role.roleId.Is939()); } catch { } if (NetworkServer.active) { Handcuffs component = rh.characterClassManager.GetComponent <Handcuffs>(); component.ClearTarget(); component.NetworkCufferId = -1; } if (role.team != Team.RIP) { if (NetworkServer.active && !lite) { rh.characterClassManager._pms.OnPlayerClassChange(pos, rotY); if (!rh.characterClassManager.SpawnProtected && rh.characterClassManager.EnableSP && rh.characterClassManager.SProtectedTeam.Contains((int)role.team)) { rh.characterClassManager.GodMode = true; rh.characterClassManager.SpawnProtected = true; rh.characterClassManager.ProtectedTime = Time.time; } } if (!rh.characterClassManager.isLocalPlayer) { rh.characterClassManager.GetComponent <PlayerStats>().maxHP = role.maxHP; } } rh.characterClassManager.Scp0492.iAm049_2 = rh.characterClassManager.CurClass == RoleType.Scp0492; rh.characterClassManager.Scp106.iAm106 = rh.characterClassManager.CurClass == RoleType.Scp106; rh.characterClassManager.Scp173.iAm173 = rh.characterClassManager.CurClass == RoleType.Scp173; rh.characterClassManager.Scp939.iAm939 = rh.characterClassManager.CurClass.Is939(); rh.characterClassManager.RefreshPlyModel(RoleType.None); }