/// <summary> /// when we get a new kill, synchronize and add points to the player /// </summary> public void AddKill(bool m_heat, string m_weapon, int W_id) { //Send a new event keelfeed //bl_EventHandler.KillEvent(PhotonNetwork.player.name, this.gameObject.name, "Killed ["+m_weaponEnemy+"]", (string)PhotonNetwork.player.customProperties["Team"],777, 30); bl_KillFeed feed = GameObject.FindWithTag("GameManager").GetComponent <bl_KillFeed>(); if (!m_heat) { feed.OnKillFeed(base.LocalName, this.gameObject.name, "Killed [" + m_weapon + "]", myTeam, W_id, 30); } else { feed.OnKillFeed(base.LocalName, this.gameObject.name, "HeatShot! [" + m_weapon + "]", myTeam, 6, 30); } //Add a new kill and update information PhotonNetwork.player.PostKill(1);//Send a new kill //Add xp for score and update int rando; //If heatshot will give you double experience if (m_heat) { rando = Random.Range((int)RandomScore.x * 2, (int)RandomScore.y * 2); bl_EventHandler.OnKillEvent("Killed Enemy", (int)rando / 2); bl_EventHandler.OnKillEvent("HeatShot Bonus", (int)rando / 2); } else { rando = Random.Range((int)RandomScore.x, (int)RandomScore.y); bl_EventHandler.OnKillEvent("Killed Enemy", (int)rando); } //Send to update score to player PhotonNetwork.player.PostScore(rando); //TDM only if the score is updated if (GetGameMode == GameMode.TDM) { //Update ScoreBoard if (myTeam == Team.Delta.ToString()) { int CurrentScore = (int)PhotonNetwork.room.customProperties[PropiertiesKeys.Team1Score]; CurrentScore++; Hashtable setTeamScore = new Hashtable(); setTeamScore.Add(PropiertiesKeys.Team1Score, CurrentScore); PhotonNetwork.room.SetCustomProperties(setTeamScore); } else if (myTeam == Team.Recon.ToString()) { int CurrentScore = (int)PhotonNetwork.room.customProperties[PropiertiesKeys.Team2Score]; CurrentScore++; Hashtable setTeamScore = new Hashtable(); setTeamScore.Add(PropiertiesKeys.Team2Score, CurrentScore); PhotonNetwork.room.SetCustomProperties(setTeamScore); } } }
/// <summary> /// when we get a new kill, synchronize and add points to the player /// </summary> public void AddKill(bool m_heat, string m_weapon, int W_id) { //Send a new event kill feed string killfeedText = string.Empty; if (!m_heat) { #if LOCALIZATION killfeedText = string.Format("{0} [{1}]", bl_Localization.Instance.GetText(15), m_weapon); #else killfeedText = string.Format("{0} [{1}]", bl_GameTexts.Killed, m_weapon); #endif KillFeed.OnKillFeed(base.LocalName, this.gameObject.name, killfeedText, myTeam, W_id, 30); #if KILL_STREAK bl_KillNotifierManager kn = bl_KillNotifierUtils.GetManager; if (kn != null) { kn.NewKill(); } else { Debug.LogWarning("Kill streak notifier is enabled but not integrate in this scene."); } #endif } else { bl_GameManager.Instance.Headshots++; #if LOCALIZATION killfeedText = string.Format("{0} [{1}]", bl_Localization.Instance.GetText(16), m_weapon); #else killfeedText = string.Format("{0} [{1}]", bl_GameTexts.HeadShot, m_weapon); #endif KillFeed.OnKillFeed(base.LocalName, this.gameObject.name, killfeedText, myTeam, 6, 30); #if KILL_STREAK bl_KillNotifierManager kn = bl_KillNotifierUtils.GetManager; if (kn != null) { kn.NewKill(true); } else { Debug.LogWarning("Kill streak notifier is enabled but not integrate in this scene."); } #endif } //Add a new kill and update information PhotonNetwork.LocalPlayer.PostKill(1);//Send a new kill //Add xp for score and update int score = (m_heat) ? GameData.ScoreReward.ScorePerKill + GameData.ScoreReward.ScorePerHeadShot : GameData.ScoreReward.ScorePerKill; //show an local notification for the kill bl_KillFeed.LocalKillInfo localKillInfo = new bl_KillFeed.LocalKillInfo(); localKillInfo.Killed = gameObject.name; localKillInfo.HeadShot = m_heat; localKillInfo.Weapon = m_weapon; bl_EventHandler.OnKillEvent(localKillInfo); //Send to update score to player PhotonNetwork.LocalPlayer.PostScore(score); //TDM only if the score is updated if (GetGameMode == GameMode.TDM) { //Update ScoreBoard if (myTeam == Team.Delta.ToString()) { int CurrentScore = (int)PhotonNetwork.CurrentRoom.CustomProperties[PropertiesKeys.Team1Score]; CurrentScore++; Hashtable setTeamScore = new Hashtable(); setTeamScore.Add(PropertiesKeys.Team1Score, CurrentScore); PhotonNetwork.CurrentRoom.SetCustomProperties(setTeamScore); } else if (myTeam == Team.Recon.ToString()) { int CurrentScore = (int)PhotonNetwork.CurrentRoom.CustomProperties[PropertiesKeys.Team2Score]; CurrentScore++; Hashtable setTeamScore = new Hashtable(); setTeamScore.Add(PropertiesKeys.Team2Score, CurrentScore); PhotonNetwork.CurrentRoom.SetCustomProperties(setTeamScore); } } #if GR if (GetGameMode == GameMode.GR) { GunRace.GetNextGun(); } #endif }
/// <summary> /// when we get a new kill, synchronize and add points to the player /// </summary> public void AddKill(bool m_heat, string m_weapon, int W_id) { //Send a new event kill feed string killfeedText = ""; if (!m_heat) { killfeedText = string.Format("{0} [{1}]", bl_GameTexts.Killed, m_weapon); KillFeed.OnKillFeed(base.LocalName, this.gameObject.name, killfeedText, myTeam, W_id, 30); #if KILL_STREAK bl_KillNotifierUtils.GetManager.NewKill(); #endif } else { killfeedText = string.Format("{0} [{1}]", bl_GameTexts.HeadShot, m_weapon); KillFeed.OnKillFeed(base.LocalName, this.gameObject.name, killfeedText, myTeam, 6, 30); #if KILL_STREAK bl_KillNotifierUtils.GetManager.NewKill(true); #endif } //Add a new kill and update information PhotonNetwork.player.PostKill(1);//Send a new kill //Add xp for score and update int score; //If heat shot will give you double experience if (m_heat) { bl_EventHandler.OnKillEvent(bl_GameTexts.KilledEnemy, GameData.ScorePerKill); bl_EventHandler.OnKillEvent(bl_GameTexts.HeatShotBonus, GameData.HeadShotScoreBonus); score = GameData.ScorePerKill + GameData.HeadShotScoreBonus; } else { bl_EventHandler.OnKillEvent(bl_GameTexts.KilledEnemy, GameData.ScorePerKill); score = GameData.ScorePerKill; } //Send to update score to player PhotonNetwork.player.PostScore(score); //TDM only if the score is updated if (GetGameMode == GameMode.TDM) { //Update ScoreBoard if (myTeam == Team.Delta.ToString()) { int CurrentScore = (int)PhotonNetwork.room.CustomProperties[PropertiesKeys.Team1Score]; CurrentScore++; Hashtable setTeamScore = new Hashtable(); setTeamScore.Add(PropertiesKeys.Team1Score, CurrentScore); PhotonNetwork.room.SetCustomProperties(setTeamScore); } else if (myTeam == Team.Recon.ToString()) { int CurrentScore = (int)PhotonNetwork.room.CustomProperties[PropertiesKeys.Team2Score]; CurrentScore++; Hashtable setTeamScore = new Hashtable(); setTeamScore.Add(PropertiesKeys.Team2Score, CurrentScore); PhotonNetwork.room.SetCustomProperties(setTeamScore); } } }