// Deadly hooks private void HandleHookToObj(int viewId) { PhotonView pv = PhotonView.Find(viewId); if (pv == null || !Guardian.Mod.Properties.DeadlyHooks.Value || !PhotonNetwork.isMasterClient) { return; } HERO hero = pv.gameObject.GetComponent <HERO>(); if (hero == null || hero.HasDied()) { return; } string killer = GExtensions.AsString(photonView.owner.customProperties[PhotonPlayerProperty.Name]); if (killer.StripNGUI().Length < 1) { killer = "Player"; } killer += $" [FFCC00]({photonView.owner.Id})[FFFFFF]"; hero.MarkDead(); hero.photonView.RPC("netDie2", pv.owner, -1, $"{killer}'s hook"); }
public override void Execute(InRoomChat irc, string[] args) { if (RCSettings.TeamMode == 1) { if (args.Length > 0) { if (args[0].Equals("1") || args[0].Equals("cyan", StringComparison.OrdinalIgnoreCase)) { FengGameManagerMKII.Instance.photonView.RPC("setTeamRPC", PhotonNetwork.player, 1); irc.AddLine("You have joined team Cyan.".WithColor("00FFFF")); HERO hero = GameHelper.GetHero(PhotonNetwork.player); if (hero != null) { hero.MarkDead(); hero.photonView.RPC("netDie2", PhotonTargets.All, new object[] { -1, "Team Switch" }); } } else if (args[0].Equals("2") || args[0].Equals("magenta", StringComparison.OrdinalIgnoreCase)) { FengGameManagerMKII.Instance.photonView.RPC("setTeamRPC", PhotonNetwork.player, 2); irc.AddLine("You have joined team Magenta.".WithColor("FF00FF")); HERO hero = GameHelper.GetHero(PhotonNetwork.player); if (hero != null) { hero.MarkDead(); hero.photonView.RPC("netDie2", PhotonTargets.All, -1, "Team Switch"); } } else if (args[0].Equals("0") || args[0].Equals("individual", StringComparison.OrdinalIgnoreCase)) { FengGameManagerMKII.Instance.photonView.RPC("setTeamRPC", PhotonNetwork.player, 0); irc.AddLine("You have joined team Individual.".WithColor("FFFFFF")); HERO hero = GameHelper.GetHero(PhotonNetwork.player); if (hero != null) { hero.MarkDead(); hero.photonView.RPC("netDie2", PhotonTargets.All, -1, "Team Switch"); } } else { irc.AddLine("Invalid team. Accepted values are 0, 1, and 2.".WithColor("FFCC00")); } } } else { irc.AddLine("Teams are either locked or disabled.".WithColor("FFCC00")); } }
private void OnTriggerEnter(Collider other) { GameObject gameObject = other.gameObject; if (gameObject.layer != 8) { return; } gameObject = gameObject.transform.root.gameObject; if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer && gameObject.GetPhotonView() != null && gameObject.GetPhotonView().isMine) { HERO component = gameObject.GetComponent <HERO>(); if (component != null) { component.MarkDead(); component.photonView.RPC("netDie2", PhotonTargets.All, -1, "Server"); } } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.layer != 8) { return; } if (IN_GAME_MAIN_CAMERA.Gametype != GameType.Multiplayer) { return; } GameObject otherGo = other.gameObject.transform.root.gameObject; HERO component = otherGo.GetComponent <HERO>(); if (component == null || !component.photonView.isMine || component.HasDied()) { return; } component.MarkDead(); component.photonView.RPC("netDie2", PhotonTargets.All, -1, Guardian.Mod.Properties.LavaDeathMessage.Value); }
private void Update() { if (!launched) { return; } base.transform.Rotate(r); v -= 20f * Vector3.up * Time.deltaTime; base.transform.position += v * Time.deltaTime; if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer && !PhotonNetwork.isMasterClient) { return; } LayerMask mask = 1 << LayerMask.NameToLayer("Ground"); LayerMask mask2 = 1 << LayerMask.NameToLayer("Players"); LayerMask mask3 = 1 << LayerMask.NameToLayer("EnemyAABB"); LayerMask mask4 = (int)mask2 | (int)mask | (int)mask3; Vector3 position = base.transform.position; Vector3 lossyScale = base.transform.lossyScale; RaycastHit[] array = Physics.SphereCastAll(position, 2.5f * lossyScale.x, base.transform.position - oldP, Vector3.Distance(base.transform.position, oldP), mask4); for (int i = 0; i < array.Length; i++) { RaycastHit raycastHit = array[i]; switch (LayerMask.LayerToName(raycastHit.collider.gameObject.layer)) { case "EnemyAABB": GameObject gameObject = raycastHit.collider.gameObject.transform.root.gameObject; TITAN titan = gameObject.GetComponent <TITAN>(); if (titan != null && !titan.hasDie) { titan.hitAnkle(); if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer) { titan.photonView.RPC("hitAnkleRPC", PhotonTargets.Others, titan.photonView.ownerId); } } explode(); break; case "Players": GameObject gameObject2 = raycastHit.collider.gameObject.transform.root.gameObject; TITAN_EREN eren = gameObject2.GetComponent <TITAN_EREN>(); if (eren != null) { if (!eren.isHit) { eren.hitByTitan(); } } else { HERO hero = gameObject2.GetComponent <HERO>(); if (hero != null && !hero.HasDied() && !hero.IsInvincible() && !hero.isGrabbed) { if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { hero.Die(v.normalized * 1000f + Vector3.up * 50f, isBite: false); } else if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer) { hero.MarkDead(); int num = -1; string text = "Rock"; EnemyfxIDcontainer efxIDContainer = base.transform.root.gameObject.GetComponent <EnemyfxIDcontainer>(); if (efxIDContainer != null) { num = efxIDContainer.myOwnerViewID; text = efxIDContainer.titanName; } hero.photonView.RPC("netDie", PhotonTargets.All, v.normalized * 1000f + Vector3.up * 50f, false, num, text, true); } } } break; case "Ground": explode(); break; } } oldP = base.transform.position; }
public override void OnUpdate() { if (GameHelper.CurrentTimeMillis() - LastPollTime < 1000) { return; } Dictionary <int, int> newTimes = new Dictionary <int, int>(LifeTimes); LastPollTime = GameHelper.CurrentTimeMillis(); foreach (KeyValuePair <int, int> entry in LifeTimes) { PhotonPlayer player = PhotonPlayer.Find(entry.Key); if (player == null) { continue; } HERO hero = player.GetHero(); if (hero == null) { continue; } int timeLeft = entry.Value; if (entry.Value >= 0) { timeLeft--; player.SetCustomProperties(new ExitGames.Client.Photon.Hashtable { { PhotonPlayerProperty.TotalDamage, timeLeft } }); } if (timeLeft <= 0) { PhotonNetwork.Instantiate("FX/Thunder", hero.transform.position, hero.transform.rotation, 0); hero.MarkDead(); hero.photonView.RPC("netDie2", player, -1, "[FF4444]Time's Up!"); GameHelper.Broadcast($"{GExtensions.AsString(player.customProperties[PhotonPlayerProperty.Name]).NGUIToUnity().AsColor("FFFFFF")} ran out of time!" .AsColor("FF0000")); LifeTimes[hero.photonView.owner.Id] = StartTime.Value; } else if (timeLeft == 15) { FengGameManagerMKII.Instance.photonView.RPC("Chat", player, $"15 seconds left...".AsColor("FF0000"), string.Empty); } else if (timeLeft < 6) { FengGameManagerMKII.Instance.photonView.RPC("Chat", player, $"{timeLeft}...".AsColor("FF0000"), string.Empty); } newTimes[entry.Key] = timeLeft; } LifeTimes = newTimes; }
public void DoAction() { switch (actionClass) { case 0: nextEvent.CheckEvent(); break; case 1: { string text5 = parameters[0].returnString(null); int num3 = parameters[1].ReturnInt(null); switch (actionType) { case 7: case 8: case 9: case 10: case 11: break; case 0: if (!FengGameManagerMKII.IntVariables.ContainsKey(text5)) { FengGameManagerMKII.IntVariables.Add(text5, num3); } else { FengGameManagerMKII.IntVariables[text5] = num3; } break; case 1: if (!FengGameManagerMKII.IntVariables.ContainsKey(text5)) { CallException("Variable not found: " + text5); } else { FengGameManagerMKII.IntVariables[text5] = (int)FengGameManagerMKII.IntVariables[text5] + num3; } break; case 2: if (!FengGameManagerMKII.IntVariables.ContainsKey(text5)) { CallException("Variable not found: " + text5); } else { FengGameManagerMKII.IntVariables[text5] = (int)FengGameManagerMKII.IntVariables[text5] - num3; } break; case 3: if (!FengGameManagerMKII.IntVariables.ContainsKey(text5)) { CallException("Variable not found: " + text5); } else { FengGameManagerMKII.IntVariables[text5] = (int)FengGameManagerMKII.IntVariables[text5] * num3; } break; case 4: if (!FengGameManagerMKII.IntVariables.ContainsKey(text5)) { CallException("Variable not found: " + text5); } else { FengGameManagerMKII.IntVariables[text5] = (int)FengGameManagerMKII.IntVariables[text5] / num3; } break; case 5: if (!FengGameManagerMKII.IntVariables.ContainsKey(text5)) { CallException("Variable not found: " + text5); } else { FengGameManagerMKII.IntVariables[text5] = (int)FengGameManagerMKII.IntVariables[text5] % num3; } break; case 6: if (!FengGameManagerMKII.IntVariables.ContainsKey(text5)) { CallException("Variable not found: " + text5); } else { FengGameManagerMKII.IntVariables[text5] = (int)Math.Pow((int)FengGameManagerMKII.IntVariables[text5], num3); } break; case 12: if (!FengGameManagerMKII.IntVariables.ContainsKey(text5)) { FengGameManagerMKII.IntVariables.Add(text5, UnityEngine.Random.Range(num3, parameters[2].ReturnInt(null))); } else { FengGameManagerMKII.IntVariables[text5] = UnityEngine.Random.Range(num3, parameters[2].ReturnInt(null)); } break; } break; } case 2: { string text4 = parameters[0].returnString(null); bool flag = parameters[1].returnBool(null); switch (actionType) { case 0: if (!FengGameManagerMKII.BoolVariables.ContainsKey(text4)) { FengGameManagerMKII.BoolVariables.Add(text4, flag); } else { FengGameManagerMKII.BoolVariables[text4] = flag; } break; case 11: if (!FengGameManagerMKII.BoolVariables.ContainsKey(text4)) { CallException("Variable not found: " + text4); } else { FengGameManagerMKII.BoolVariables[text4] = !(bool)FengGameManagerMKII.BoolVariables[text4]; } break; case 12: if (!FengGameManagerMKII.BoolVariables.ContainsKey(text4)) { FengGameManagerMKII.BoolVariables.Add(text4, Convert.ToBoolean(UnityEngine.Random.Range(0, 2))); } else { FengGameManagerMKII.BoolVariables[text4] = Convert.ToBoolean(UnityEngine.Random.Range(0, 2)); } break; } break; } case 3: { string key3 = parameters[0].returnString(null); switch (actionType) { case 0: { string value2 = parameters[1].returnString(null); if (!FengGameManagerMKII.StringVariables.ContainsKey(key3)) { FengGameManagerMKII.StringVariables.Add(key3, value2); } else { FengGameManagerMKII.StringVariables[key3] = value2; } break; } case 7: { string text3 = string.Empty; for (int i = 1; i < parameters.Length; i++) { text3 += parameters[i].returnString(null); } if (!FengGameManagerMKII.StringVariables.ContainsKey(key3)) { FengGameManagerMKII.StringVariables.Add(key3, text3); } else { FengGameManagerMKII.StringVariables[key3] = text3; } break; } case 8: { string str = parameters[1].returnString(null); if (!FengGameManagerMKII.StringVariables.ContainsKey(key3)) { CallException("No Variable"); } else { FengGameManagerMKII.StringVariables[key3] = (string)FengGameManagerMKII.StringVariables[key3] + str; } break; } case 9: { string text = parameters[1].returnString(null); if (!FengGameManagerMKII.StringVariables.ContainsKey(key3)) { CallException("No Variable"); break; } string text2 = (string)FengGameManagerMKII.StringVariables[key3]; FengGameManagerMKII.StringVariables[key3] = text2.Replace(parameters[1].returnString(null), parameters[2].returnString(null)); break; } } break; } case 4: { string key2 = parameters[0].returnString(null); float num2 = parameters[1].returnFloat(null); switch (actionType) { case 7: case 8: case 9: case 10: case 11: break; case 0: if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2)) { FengGameManagerMKII.FloatVariables.Add(key2, num2); } else { FengGameManagerMKII.FloatVariables[key2] = num2; } break; case 1: if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2)) { CallException("No Variable"); } else { FengGameManagerMKII.FloatVariables[key2] = (float)FengGameManagerMKII.FloatVariables[key2] + num2; } break; case 2: if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2)) { CallException("No Variable"); } else { FengGameManagerMKII.FloatVariables[key2] = (float)FengGameManagerMKII.FloatVariables[key2] - num2; } break; case 3: if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2)) { CallException("No Variable"); } else { FengGameManagerMKII.FloatVariables[key2] = (float)FengGameManagerMKII.FloatVariables[key2] * num2; } break; case 4: if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2)) { CallException("No Variable"); } else { FengGameManagerMKII.FloatVariables[key2] = (float)FengGameManagerMKII.FloatVariables[key2] / num2; } break; case 5: if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2)) { CallException("No Variable"); } else { FengGameManagerMKII.FloatVariables[key2] = (float)FengGameManagerMKII.FloatVariables[key2] % num2; } break; case 6: if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2)) { CallException("No Variable"); } else { FengGameManagerMKII.FloatVariables[key2] = (float)Math.Pow((int)FengGameManagerMKII.FloatVariables[key2], num2); } break; case 12: if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2)) { FengGameManagerMKII.FloatVariables.Add(key2, UnityEngine.Random.Range(num2, parameters[2].returnFloat(null))); } else { FengGameManagerMKII.FloatVariables[key2] = UnityEngine.Random.Range(num2, parameters[2].returnFloat(null)); } break; } break; } case 5: { string key4 = parameters[0].returnString(null); PhotonPlayer value3 = parameters[1].returnPlayer(null); if (actionType == 0) { if (!FengGameManagerMKII.PlayerVariables.ContainsKey(key4)) { FengGameManagerMKII.PlayerVariables.Add(key4, value3); } else { FengGameManagerMKII.PlayerVariables[key4] = value3; } } break; } case 6: { string key = parameters[0].returnString(null); TITAN value = parameters[1].returnTitan(null); if (actionType == 0) { if (!FengGameManagerMKII.TitanVariables.ContainsKey(key)) { FengGameManagerMKII.TitanVariables.Add(key, value); } else { FengGameManagerMKII.TitanVariables[key] = value; } } break; } case 7: { PhotonPlayer photonPlayer = parameters[0].returnPlayer(null); switch (actionType) { case 0: { if (FengGameManagerMKII.HeroHash.ContainsKey(photonPlayer.Id)) { HERO hERO2 = (HERO)FengGameManagerMKII.HeroHash[photonPlayer.Id]; hERO2.MarkDead(); hERO2.photonView.RPC("netDie2", PhotonTargets.All, -1, parameters[1].returnString(null) + " "); } else { CallException("Player Not Alive"); } break; } case 1: FengGameManagerMKII.Instance.photonView.RPC("respawnHeroInNewRound", photonPlayer); break; case 2: FengGameManagerMKII.Instance.photonView.RPC("spawnPlayerAtRPC", photonPlayer, parameters[1].returnFloat(null), parameters[2].returnFloat(null), parameters[3].returnFloat(null)); break; case 3: { int iD = photonPlayer.Id; if (FengGameManagerMKII.HeroHash.ContainsKey(iD)) { HERO hERO = (HERO)FengGameManagerMKII.HeroHash[iD]; hERO.photonView.RPC("moveToRPC", photonPlayer, parameters[1].returnFloat(null), parameters[2].returnFloat(null), parameters[3].returnFloat(null)); } else { CallException("Player Not Alive"); } break; } case 4: { Hashtable hashtable11 = new Hashtable(); hashtable11.Add(PhotonPlayerProperty.Kills, parameters[1].ReturnInt(null)); photonPlayer.SetCustomProperties(hashtable11); break; } case 5: { Hashtable hashtable10 = new Hashtable(); hashtable10.Add(PhotonPlayerProperty.Deaths, parameters[1].ReturnInt(null)); photonPlayer.SetCustomProperties(hashtable10); break; } case 6: { Hashtable hashtable9 = new Hashtable(); hashtable9.Add(PhotonPlayerProperty.MaxDamage, parameters[1].ReturnInt(null)); photonPlayer.SetCustomProperties(hashtable9); break; } case 7: { Hashtable hashtable8 = new Hashtable(); hashtable8.Add(PhotonPlayerProperty.TotalDamage, parameters[1].ReturnInt(null)); photonPlayer.SetCustomProperties(hashtable8); break; } case 8: { Hashtable hashtable7 = new Hashtable(); hashtable7.Add(PhotonPlayerProperty.Name, parameters[1].returnString(null)); photonPlayer.SetCustomProperties(hashtable7); break; } case 9: { Hashtable hashtable6 = new Hashtable(); hashtable6.Add(PhotonPlayerProperty.Guild, parameters[1].returnString(null)); photonPlayer.SetCustomProperties(hashtable6); break; } case 10: { Hashtable hashtable5 = new Hashtable(); hashtable5.Add(PhotonPlayerProperty.RCTeam, parameters[1].ReturnInt(null)); photonPlayer.SetCustomProperties(hashtable5); break; } case 11: { Hashtable hashtable4 = new Hashtable(); hashtable4.Add(PhotonPlayerProperty.CustomInt, parameters[1].ReturnInt(null)); photonPlayer.SetCustomProperties(hashtable4); break; } case 12: { Hashtable hashtable3 = new Hashtable(); hashtable3.Add(PhotonPlayerProperty.CustomBool, parameters[1].returnBool(null)); photonPlayer.SetCustomProperties(hashtable3); break; } case 13: { Hashtable hashtable2 = new Hashtable(); hashtable2.Add(PhotonPlayerProperty.CustomString, parameters[1].returnString(null)); photonPlayer.SetCustomProperties(hashtable2); break; } case 14: { Hashtable hashtable = new Hashtable(); hashtable.Add(PhotonPlayerProperty.RCTeam, parameters[1].returnFloat(null)); photonPlayer.SetCustomProperties(hashtable); break; } } break; } case 8: switch (actionType) { case 0: { TITAN titanObj = parameters[0].returnTitan(null); object[] array = new object[2] { parameters[1].returnPlayer(null).Id, parameters[2].ReturnInt(null) }; titanObj.photonView.RPC("titanGetHit", titanObj.photonView.owner, array); break; } case 1: FengGameManagerMKII.Instance.SpawnTitanAction(parameters[0].ReturnInt(null), parameters[1].returnFloat(null), parameters[2].ReturnInt(null), parameters[3].ReturnInt(null)); break; case 2: FengGameManagerMKII.Instance.SpawnTitanAtAction(parameters[0].ReturnInt(null), parameters[1].returnFloat(null), parameters[2].ReturnInt(null), parameters[3].ReturnInt(null), parameters[4].returnFloat(null), parameters[5].returnFloat(null), parameters[6].returnFloat(null)); break; case 3: { TITAN titanObj = parameters[0].returnTitan(null); int num = titanObj.currentHealth = parameters[1].ReturnInt(null); if (titanObj.maxHealth == 0) { titanObj.maxHealth = titanObj.currentHealth; } titanObj.photonView.RPC("labelRPC", PhotonTargets.AllBuffered, titanObj.currentHealth, titanObj.maxHealth); break; } case 4: { TITAN titanObj = parameters[0].returnTitan(null); if (titanObj.photonView.isMine) { titanObj.MoveTo(parameters[1].returnFloat(null), parameters[2].returnFloat(null), parameters[3].returnFloat(null)); } else { titanObj.photonView.RPC("moveToRPC", titanObj.photonView.owner, parameters[1].returnFloat(null), parameters[2].returnFloat(null), parameters[3].returnFloat(null)); } break; } } break; case 9: switch (actionType) { case 0: FengGameManagerMKII.Instance.photonView.RPC("Chat", PhotonTargets.All, parameters[0].returnString(null), string.Empty); break; case 2: FengGameManagerMKII.Instance.LoseGame(); if (parameters[0].returnBool(null)) { FengGameManagerMKII.IntVariables.Clear(); FengGameManagerMKII.BoolVariables.Clear(); FengGameManagerMKII.StringVariables.Clear(); FengGameManagerMKII.FloatVariables.Clear(); FengGameManagerMKII.PlayerVariables.Clear(); FengGameManagerMKII.TitanVariables.Clear(); } break; case 1: FengGameManagerMKII.Instance.WinGame(); if (parameters[0].returnBool(null)) { FengGameManagerMKII.IntVariables.Clear(); FengGameManagerMKII.BoolVariables.Clear(); FengGameManagerMKII.StringVariables.Clear(); FengGameManagerMKII.FloatVariables.Clear(); FengGameManagerMKII.PlayerVariables.Clear(); FengGameManagerMKII.TitanVariables.Clear(); } break; case 3: if (parameters[0].returnBool(null)) { FengGameManagerMKII.IntVariables.Clear(); FengGameManagerMKII.BoolVariables.Clear(); FengGameManagerMKII.StringVariables.Clear(); FengGameManagerMKII.FloatVariables.Clear(); FengGameManagerMKII.PlayerVariables.Clear(); FengGameManagerMKII.TitanVariables.Clear(); } FengGameManagerMKII.Instance.RestartGame(); break; } break; } }
public override void OnUpdate() { if (GameHelper.CurrentTimeMillis() - LastPollTime < 1000) { return; } LastPollTime = GameHelper.CurrentTimeMillis(); if (GameHelper.CurrentTimeMillis() >= NextKillTime) { NextKillTime = GameHelper.CurrentTimeMillis() + (KillInterval.Value * 1000); if (FengGameManagerMKII.Instance.Heroes.Count > 1) { int playersAlive = 0; int highestKills = int.MinValue; HERO bestPlayer = null; int lowestKills = int.MaxValue; HERO worstPlayer = null; foreach (PhotonPlayer player in PhotonNetwork.playerList) { HERO hero = player.GetHero(); if (hero == null) { continue; } playersAlive++; int kills = GExtensions.AsInt(player.customProperties[PhotonPlayerProperty.Kills]); if (kills < lowestKills) { lowestKills = kills; worstPlayer = hero; } if (kills > highestKills) { highestKills = kills; bestPlayer = hero; } } if (worstPlayer != null && playersAlive > 1) { PhotonNetwork.Instantiate("FX/Thunder", worstPlayer.transform.position, worstPlayer.transform.rotation, 0); worstPlayer.MarkDead(); worstPlayer.photonView.RPC("netDie2", worstPlayer.photonView.owner, -1, "Lowest Kill Count"); GameHelper.Broadcast($"{GExtensions.AsString(worstPlayer.photonView.owner.customProperties[PhotonPlayerProperty.Name]).NGUIToUnity().AsColor("FFFFFF")} didn't make it!".AsColor("FF0000")); } if (playersAlive < 3 && bestPlayer != null) { GameHelper.Broadcast($"{GExtensions.AsString(bestPlayer.photonView.owner.customProperties[PhotonPlayerProperty.Name]).NGUIToUnity().AsColor("FFFFFF")} wins!".AsColor("AAFF00")); FengGameManagerMKII.Instance.FinishGame(); return; } else { ExitGames.Client.Photon.Hashtable props = new ExitGames.Client.Photon.Hashtable { { PhotonPlayerProperty.Kills, 0 }, { PhotonPlayerProperty.Deaths, 0 }, { PhotonPlayerProperty.MaxDamage, 0 }, { PhotonPlayerProperty.TotalDamage, 0 }, }; foreach (PhotonPlayer player in PhotonNetwork.playerList) { player.SetCustomProperties(props); } } } GameHelper.Broadcast($"A new {KillInterval.Value} second period has begun!"); } else if (NextKillTime - GameHelper.CurrentTimeMillis() > 5000) { return; } int timeLeft = MathHelper.Floor((NextKillTime - GameHelper.CurrentTimeMillis()) / 1000f) + 1; GameHelper.Broadcast($"{timeLeft}...".AsColor("FF0000")); }
private void OnTriggerStay(Collider other) { if ((IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer && !base.transform.root.gameObject.GetPhotonView().isMine) || !active_me) { return; } switch (other.gameObject.tag) { case "playerHitbox": // Another player { if (!FengGameManagerMKII.Level.PVP) { return; } HitBox hitbox = other.gameObject.GetComponent <HitBox>(); if (hitbox == null || hitbox.transform.root == null) { return; } HERO hero = hitbox.transform.root.GetComponent <HERO>(); if (hero != null && hero.myTeam != myTeam && !hero.IsInvincible()) { float damage = 1f - Vector3.Distance(other.gameObject.transform.position, base.transform.position) * 0.05f; damage = Mathf.Min(1f, damage); if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (!hero.isGrabbed) { hero.Die((hitbox.transform.root.transform.position - base.transform.position).normalized * damage * 1000f + Vector3.up * 50f, isBite: false); } } else if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer && !hero.HasDied() && !hero.isGrabbed) { hero.MarkDead(); hero.photonView.RPC("netDie", PhotonTargets.All, (hitbox.transform.root.position - base.transform.position).normalized * damage * 1000f + Vector3.up * 50f, false, viewID, ownerName, false); } } break; } case "erenHitbox": // Eren, idk where his hitbox is LOL { if (dmg > 0 && !other.gameObject.transform.root.gameObject.GetComponent <TITAN_EREN>().isHit) { other.gameObject.transform.root.gameObject.GetComponent <TITAN_EREN>().HitByTitan(); } break; } case "titanneck": // Normal/Female/Colossal Titan nape { HitBox hitbox = other.gameObject.GetComponent <HitBox>(); if (hitbox == null || !CheckIfBehind(hitbox.transform.root.gameObject) || currentHits.Contains(hitbox)) { return; } hitbox.hitPosition = (base.transform.position + hitbox.transform.position) * 0.5f; currentHits.Add(hitbox); // Custom hit sound hitSound.Play(); int damage = (int)((currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity - hitbox.transform.root.rigidbody.velocity).magnitude * 10f * scoreMulti); damage = Mathf.Max(10, damage); // Local minimum damage if (damage < Guardian.Mod.Properties.LocalMinDamage.Value) { GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().ShowDamage(damage); return; } TITAN titan = hitbox.transform.root.GetComponent <TITAN>(); if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (titan != null && !titan.hasDie) { FengGameManagerMKII fgmkii = GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>(); fgmkii.netShowDamage(damage); if ((float)damage > titan.myLevel * 100f) { titan.Die(); if (PlayerPrefs.GetInt("EnableSS", 0) == 1) { currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, damage, hitbox.transform.root.gameObject, 0.02f); } fgmkii.UpdatePlayerKillInfo(damage); } } return; } if (titan != null) { if (!titan.hasDie) { if ((float)damage > titan.myLevel * 100f) { if (PlayerPrefs.GetInt("EnableSS", 0) == 1) { currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, damage, hitbox.transform.root.gameObject, 0.02f); } titan.photonView.RPC("titanGetHit", titan.photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage); } } } else if ((bool)hitbox.transform.root.GetComponent <FEMALE_TITAN>()) { FEMALE_TITAN ft = hitbox.transform.root.GetComponent <FEMALE_TITAN>(); if (!ft.hasDie) { ft.photonView.RPC("titanGetHit", ft.photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage); } } else if ((bool)hitbox.transform.root.GetComponent <COLOSSAL_TITAN>() && !hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().hasDie) { hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.RPC("titanGetHit", hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage); } ShowCriticalHitFX(other.gameObject.transform.position); break; } case "titaneye": // Titan/Female Titan eyes if (currentHits.Contains(other.gameObject)) { return; } currentHits.Add(other.gameObject); GameObject gameObject = other.gameObject.transform.root.gameObject; if ((bool)gameObject.GetComponent <FEMALE_TITAN>()) { if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (!gameObject.GetComponent <FEMALE_TITAN>().hasDie) { gameObject.GetComponent <FEMALE_TITAN>().hitEye(); } return; } if (!gameObject.GetComponent <FEMALE_TITAN>().hasDie) { gameObject.GetComponent <FEMALE_TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID); } } else if (gameObject.GetComponent <TITAN>().abnormalType != TitanClass.Crawler) { if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (!gameObject.GetComponent <TITAN>().hasDie) { gameObject.GetComponent <TITAN>().HitEye(); } return; } if (!gameObject.GetComponent <TITAN>().hasDie) { gameObject.GetComponent <TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID); } } ShowCriticalHitFX(other.gameObject.transform.position); break; case "titanankle": // Normal/Female Titan ankles { if (currentHits.Contains(other.gameObject)) { return; } currentHits.Add(other.gameObject); GameObject gameObject2 = other.gameObject.transform.root.gameObject; TITAN titan = gameObject2.GetComponent <TITAN>(); if (titan != null && titan.abnormalType != TitanClass.Crawler) { if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (!titan.hasDie) { titan.HitAnkle(); } return; } if (!titan.hasDie) { titan.photonView.RPC("hitAnkleRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID); } } else if (gameObject2.GetComponent <FEMALE_TITAN>()) { int damage = (int)((currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity - gameObject2.rigidbody.velocity).magnitude * 10f * scoreMulti); damage = Mathf.Max(10, damage); // Local minimum damage if (damage < Guardian.Mod.Properties.LocalMinDamage.Value) { GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().ShowDamage(damage); return; } if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (other.gameObject.name == "ankleR") { if ((bool)gameObject2.GetComponent <FEMALE_TITAN>() && !gameObject2.GetComponent <FEMALE_TITAN>().hasDie) { gameObject2.GetComponent <FEMALE_TITAN>().hitAnkleR(damage); } } else if ((bool)gameObject2.GetComponent <FEMALE_TITAN>() && !gameObject2.GetComponent <FEMALE_TITAN>().hasDie) { gameObject2.GetComponent <FEMALE_TITAN>().hitAnkleL(damage); } return; } if (other.gameObject.name == "ankleR") { if (!gameObject2.GetComponent <FEMALE_TITAN>().hasDie) { gameObject2.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleRRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID, damage); } } else if (!gameObject2.GetComponent <FEMALE_TITAN>().hasDie) { gameObject2.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleLRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID, damage); } } ShowCriticalHitFX(other.gameObject.transform.position); break; } } }
private void OnTriggerStay(Collider other) { if (!active_me) { return; } if (!currentHitsII.Contains(other.gameObject)) { currentHitsII.Add(other.gameObject); currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartShake(0.1f, 0.1f); if (other.gameObject.transform.root.gameObject.tag == "titan") { currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <HERO>().slashHit.Play(); GameObject gameObject = (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) ? ((GameObject)Object.Instantiate(Resources.Load("hitMeat"))) : PhotonNetwork.Instantiate("hitMeat", base.transform.position, Quaternion.Euler(270f, 0f, 0f), 0); gameObject.transform.position = base.transform.position; base.transform.root.GetComponent <HERO>().UseBlade(); } } switch (other.gameObject.tag) { case "playerHitbox": // Another player { if (!FengGameManagerMKII.Level.PVP) { return; } HitBox hitbox = other.gameObject.GetComponent <HitBox>(); if (hitbox == null || hitbox.transform.root == null) { return; } HERO hero = hitbox.transform.root.GetComponent <HERO>(); if (hero != null && hero.myTeam != myTeam && !hero.IsInvincible()) { float damage = 1f - Vector3.Distance(other.gameObject.transform.position, base.transform.position) * 0.05f; damage = Mathf.Min(1f, damage); if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (!hero.isGrabbed) { hero.Die((hitbox.transform.root.transform.position - base.transform.position).normalized * damage * 1000f + Vector3.up * 50f, isBite: false); } return; } if (!hero.HasDied() && !hero.isGrabbed) { if (PlayerPrefs.GetInt("EnableSS", 0) == 1) { currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, 0, hitbox.transform.root.gameObject, 0.02f); } hero.MarkDead(); hero.photonView.RPC("netDie", PhotonTargets.All, (hitbox.transform.root.position - base.transform.position).normalized * damage * 1000f + Vector3.up * 50f, false, base.transform.root.gameObject.GetPhotonView().viewID, PhotonView.Find(base.transform.root.gameObject.GetPhotonView().viewID).owner.customProperties[PhotonPlayerProperty.Name], false); } } break; } case "titanneck": // Normal/Female/Colossal Titan nape { HitBox hitbox = other.gameObject.GetComponent <HitBox>(); if (hitbox == null || !checkIfBehind(hitbox.transform.root.gameObject) || currentHits.Contains(hitbox)) { return; } hitbox.hitPosition = (base.transform.position + hitbox.transform.position) * 0.5f; currentHits.Add(hitbox); meatDie.Play(); int damage = (int)((currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity - hitbox.transform.root.rigidbody.velocity).magnitude * 10f * scoreMulti); damage = Mathf.Max(10, damage); // Local minimum damage if (damage < Guardian.Mod.Properties.LocalMinDamage.Value) { GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().ShowDamage(damage); return; } TITAN titan = hitbox.transform.root.GetComponent <TITAN>(); if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (titan != null && !titan.hasDie) { if (PlayerPrefs.GetInt("EnableSS", 0) == 1) { currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, damage, hitbox.transform.root.gameObject, 0.02f); } titan.Die(); SpawnNapeMeat(currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity, hitbox.transform.root); FengGameManagerMKII fengGame = GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>(); fengGame.netShowDamage(damage); fengGame.UpdatePlayerKillInfo(damage); } return; } if (titan != null) { if (!titan.hasDie) { if (PlayerPrefs.GetInt("EnableSS", 0) == 1) { currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, damage, hitbox.transform.root.gameObject, 0.02f); } titan.photonView.RPC("titanGetHit", titan.photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage); if (Guardian.Mod.Properties.MultiplayerNapeMeat.Value) { SpawnNapeMeat(currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity, hitbox.transform.root); } } } else if ((bool)hitbox.transform.root.GetComponent <FEMALE_TITAN>()) { base.transform.root.GetComponent <HERO>().UseBlade(int.MaxValue); if (!hitbox.transform.root.GetComponent <FEMALE_TITAN>().hasDie) { hitbox.transform.root.GetComponent <FEMALE_TITAN>().photonView.RPC("titanGetHit", hitbox.transform.root.GetComponent <FEMALE_TITAN>().photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage); } } else if ((bool)hitbox.transform.root.GetComponent <COLOSSAL_TITAN>()) { base.transform.root.GetComponent <HERO>().UseBlade(int.MaxValue); if (!hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().hasDie) { hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.RPC("titanGetHit", hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage); } } ShowCriticalHitFX(); break; } case "titaneye": // Titan/Female Titan eyes if (currentHits.Contains(other.gameObject)) { return; } currentHits.Add(other.gameObject); GameObject gameObject2 = other.gameObject.transform.root.gameObject; if ((bool)gameObject2.GetComponent <FEMALE_TITAN>()) { if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (!gameObject2.GetComponent <FEMALE_TITAN>().hasDie) { gameObject2.GetComponent <FEMALE_TITAN>().hitEye(); } return; } if (!gameObject2.GetComponent <FEMALE_TITAN>().hasDie) { gameObject2.GetComponent <FEMALE_TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID); } } else if (gameObject2.GetComponent <TITAN>().abnormalType != TitanClass.Crawler) { if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (!gameObject2.GetComponent <TITAN>().hasDie) { gameObject2.GetComponent <TITAN>().HitEye(); } return; } if (!gameObject2.GetComponent <TITAN>().hasDie) { gameObject2.GetComponent <TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID); } } ShowCriticalHitFX(); break; case "titanankle": // Normal/Female Titan ankles { if (currentHits.Contains(other.gameObject)) { return; } currentHits.Add(other.gameObject); GameObject gameObject3 = other.gameObject.transform.root.gameObject; TITAN titan = gameObject3.GetComponent <TITAN>(); if (titan != null && titan.abnormalType != TitanClass.Crawler) { if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (!titan.hasDie) { titan.HitAnkle(); } return; } if (!titan.hasDie) { titan.photonView.RPC("hitAnkleRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID); } } else if (gameObject3.GetComponent <FEMALE_TITAN>()) { int damage = (int)((currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity - gameObject3.rigidbody.velocity).magnitude * 10f * scoreMulti); damage = Mathf.Max(10, damage); // Local minimum damage if (damage < Guardian.Mod.Properties.LocalMinDamage.Value) { GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().ShowDamage(damage); return; } if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) { if (other.gameObject.name == "ankleR") { if ((bool)gameObject3.GetComponent <FEMALE_TITAN>() && !gameObject3.GetComponent <FEMALE_TITAN>().hasDie) { gameObject3.GetComponent <FEMALE_TITAN>().hitAnkleR(damage); } } else if ((bool)gameObject3.GetComponent <FEMALE_TITAN>() && !gameObject3.GetComponent <FEMALE_TITAN>().hasDie) { gameObject3.GetComponent <FEMALE_TITAN>().hitAnkleL(damage); } return; } if (other.gameObject.name == "ankleR") { if (!gameObject3.GetComponent <FEMALE_TITAN>().hasDie) { gameObject3.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleRRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID, damage); } } else if (!gameObject3.GetComponent <FEMALE_TITAN>().hasDie) { gameObject3.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleLRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID, damage); } } ShowCriticalHitFX(); break; } } }