private void Awake() { if (instance == null) { instance = this; } }
void Update() { //Remove notifications in corner for (int i = 0; i < m_KillFeed.Count; i++) { KillFeed t_KillFeed = m_KillFeed[i]; t_KillFeed.m_Timer -= Time.deltaTime; if (t_KillFeed.m_Timer > 0) { m_KillFeed[i] = new KillFeed(t_KillFeed.m_Killer, t_KillFeed.m_Killed, t_KillFeed.m_HowKill, t_KillFeed.m_GunID, t_KillFeed.m_KillerColor, t_KillFeed.m_KilledColor, t_KillFeed.m_Timer); } else { m_KillFeed.RemoveAt(i); } } //Remove notifications locals for (int l = 0; l < Notify_Time.Count; l++) { Notify_Time[l] -= Time.deltaTime; if (Notify_Time[l] <= 0) { KillNotify.RemoveAt(l); Notify_Time.RemoveAt(l); } } if (UI.ScoreLocal != null) { UI.ScoreLocal.text = "<size=8>Score:</size> " + PhotonNetwork.player.customProperties[PropiertiesKeys.ScoreKey].ToString(); } }
public void SetKillFeed(KillFeed feed) { GameObject newkillfeed = Instantiate(KillfeedPrefab) as GameObject; newkillfeed.GetComponent <bl_KillFeedUI>().Init(feed); newkillfeed.transform.SetParent(KillfeedPanel, false); newkillfeed.transform.SetAsFirstSibling(); }
void Awake() { if (killfeedInstance == null) { killfeedInstance = this; } else { Destroy(this); } }
public void Init(KillFeed feed) { KillerText.text = feed.Killer; KillerText.color = feed.KillerColor; KilledText.color = feed.KilledColor; KilledText.text = feed.Killed; WeaponText.text = string.Format("{0}", feed.HowKill); KillTypeImage.gameObject.SetActive(feed.HeatShot); Alpha = GetComponent <CanvasGroup>(); StartCoroutine(Hide(10)); }
void Awake() { if (Instance == null) { Instance = this; //dont destroy on load if needed } else { Destroy(gameObject); } }
private void Start() { m_owner = PhotonView.Owner; PlayerHealthModel.CurrentTeam = m_owner.GetTeam(); if (!PhotonView.IsMine) { IsFriendly(); } transform.SetParent(null); m_killFeed = KillFeed.Instance; }
void AddNewKillFeed(string t_Killer, string t_Killed, string t_HowKill, string m_team, int t_GunID, int isHeatShot) { Color KillerColor = new Color(1, 1, 1, 1); Color KilledColor = new Color(1, 1, 1, 1); if (setting.m_GameMode != GameMode.FFA) { if (m_team == Team.Delta.ToString()) { KillerColor = isMy(t_Killer) ? SelfColor : bl_GameData.Instance.Team1Color; KilledColor = isMy(t_Killed) ? SelfColor : bl_GameData.Instance.Team2Color; } else if (m_team == Team.Recon.ToString()) { KillerColor = isMy(t_Killer) ? SelfColor : bl_GameData.Instance.Team2Color; KilledColor = isMy(t_Killed) ? SelfColor : bl_GameData.Instance.Team1Color; } else { KilledColor = Color.white; KillerColor = Color.white; } } #if LOCALIZATION if (string.IsNullOrEmpty(t_Killer)) { t_Killer = LocaleStrings[0]; } #else if (string.IsNullOrEmpty(t_Killer)) { t_Killer = bl_GameTexts.ServerMesagge; } #endif KillFeed newKillFeed = new KillFeed(); newKillFeed.Killer = t_Killer; newKillFeed.Killed = t_Killed; newKillFeed.HowKill = t_HowKill; newKillFeed.KilledColor = KilledColor; newKillFeed.KillerColor = KillerColor; newKillFeed.HeatShot = (isHeatShot == 1) ? true : false; newKillFeed.GunID = t_GunID; UIReference.SetKillFeed(newKillFeed); }
/// <summary> /// Called when a player has died, or been killed /// </summary> public override void PlayerKilled(Player player) { Log.Info($"{player.Name} was killed"); if (player.LastAttacker != null) { if (player.LastAttacker is Player attackPlayer) { KillFeed.AddEntry(attackPlayer.SteamId, attackPlayer.Name, player.SteamId, player.Name, player.LastAttackerWeapon?.ClassInfo?.Name); } else { KillFeed.AddEntry((ulong)player.LastAttacker.NetworkIdent, player.LastAttacker.ToString(), player.SteamId, player.Name, "killed"); } } else { KillFeed.AddEntry((ulong)0, "", player.SteamId, player.Name, "died"); } }
internal void KillReceived(KillFeed kill) => OnKillReceived(kill);
public KillFeed() { Current = this; StyleSheet = StyleSheet.FromFile("/ui/KillFeed.scss"); }
public void Start() { Instance = this; }
void Update() { //Remove notifications in corner for (int i = 0; i < m_KillFeed.Count; i++) { KillFeed t_KillFeed = m_KillFeed[i]; t_KillFeed.m_Timer -= Time.deltaTime; if (t_KillFeed.m_Timer > 0) m_KillFeed[i] = new KillFeed(t_KillFeed.m_Killer,t_KillFeed.m_Killed, t_KillFeed.m_HowKill,t_KillFeed.m_GunID, t_KillFeed.m_KillerColor, t_KillFeed.m_KilledColor,t_KillFeed.m_Timer); else m_KillFeed.RemoveAt(i); } //Remove notifications locals for (int l = 0; l < Notify_Time.Count; l++) { Notify_Time[l] -= Time.deltaTime; if (Notify_Time[l] <= 0) { KillNotify.RemoveAt(l); Notify_Time.RemoveAt(l); } } if (UI.ScoreLocal != null) UI.ScoreLocal.text = "<size=8>Score:</size> "+PhotonNetwork.player.customProperties[PropiertiesKeys.ScoreKey].ToString(); }
public KillFeed() { Current = this; StyleSheet.Load("/ui/KillFeed.scss"); }
public void MovementLogic() { if (!IsServer) { return; } if (!Shooter.IsValid()) { explode(false); return; } var trace = Trace.Ray(Position, Position + Rotation.Forward * MoveSpeed * Time.Delta).Size(Vector3.One * 2).HitLayer(CollisionLayer.Player).Ignore(this); if (timeSinceLaunched < 0.1f) { trace.Ignore(Shooter.Head); } var tr = trace.Run(); if (tr.Hit) { Bounces++; if (tr.Entity is Rocket other) // Hit rocket { if (Shooter != other.Shooter) { if (timeSinceLaunched < other.timeSinceLaunched) // Whoever shot second gets credit { Shooter.AddPoints(1, "Blocked Shot"); } else { other.Shooter.AddPoints(1, "Blocked Shot"); } } other.explode(false); explode(true); } else if (tr.Entity is PlayerEntity) // Hit player { if (tr.Entity.GetClientOwner().Pawn is TankPlayer hitPlayer) { var damage = new DamageInfo { Attacker = Shooter, Damage = 1 }; hitPlayer.TakeDamage(damage); bool isSelfDamage = hitPlayer == Shooter; if (!isSelfDamage) { if (Bounces == 1) { Shooter.AddPoints(1, $"Hit {hitPlayer.GetClientOwner().Name}"); } else { Shooter.AddPoints(2, $"Bounce Hit {hitPlayer.GetClientOwner().Name}", true); } } if (hitPlayer.LifeState != LifeState.Alive) { if (!isSelfDamage) { Shooter.GetClientOwner().SetScore("kills", Shooter.GetClientOwner().GetScore <int>("kills") + 1); if (Bounces == 1) { Shooter.AddPoints(2, $"Exploded {hitPlayer.GetClientOwner().Name}"); } else { Shooter.AddPoints(4, $"Bounce Exploded {hitPlayer.GetClientOwner().Name}", true); } } KillFeed.AddEntry(Shooter.GetClientOwner().SteamId, Shooter.GetClientOwner().Name, hitPlayer.GetClientOwner().SteamId, hitPlayer.GetClientOwner().Name, "rocket"); } explode(true); } } else if (Bounces > MaxBounces) // Out of bounces { explode(true); } else // Bounce off { Vector3 dir = Rotation.Forward; //DebugOverlay.Line(tr.EndPos, tr.EndPos + tr.Normal * 16, Color.Cyan, 1, false); if (tr.Normal.z != 0) // Fix the bounce direction so we don't move up or down //DebugOverlay.Sphere(tr.EndPos, 8, Color.Red, false, 1); { tr.Normal.z = 0; tr.Normal = tr.Normal.Normal; } dir = Vector3.Reflect(dir, tr.Normal); Rotation = Rotation.LookAt(dir, Vector3.Up); using (Prediction.Off()) { Particles.Create("particles/rocket_bounce.vpcf", tr.EndPos).SetForward(0, tr.Normal); Sound.FromWorld("bounce", Position); } } } Position += Rotation.Forward * MoveSpeed * Time.Delta; /*timeAlive += dt; * Light.Color = ((double) timeAlive).ToHSV();*/ }
private void Start() { killFeed = KillFeed.instance; trailStream = GetComponent <TrailStream>(); }
void Awake() { Instance = this; }