public static void AddTracer(RaycastInfo ri) { if (G.Settings.WeaponOptions.TracerLines && ri.point != new Vector3(0, 0, 0)) { TracerObject tracer = new TracerObject { HitPos = ri.point, PlayerPos = Player.player.look.aim.transform.position, ShotTime = DateTime.Now }; TracerLines.Add(tracer); } }
IEnumerator TrackMouse() { while (trackingMouse) { if (InputSubManager.instance.MainDragging) { AnchorObject.SetActive(true); TracerObject.SetActive(true); AnchorObject.transform.position = Utils.WorldToScreen(InputSubManager.instance.TouchAnchorPosition); TracerObject.transform.position = Utils.WorldToScreen(InputSubManager.instance.TouchAnchorTrackPosition); } else { AnchorObject.SetActive(false); TracerObject.SetActive(false); } yield return(null); } }
void OnGUI() { if (Provider.isConnected && !Provider.isLoading) { GUI.skin = AssetUtilities.Skin; if (!G.BeingSpied) { if (G.Settings.WeaponOptions.WeaponInfo) { GunInfoWin = GUILayout.Window(6, GunInfoWin, GunInfoWindow, "Weapon Info"); } #region Tracers if (G.Settings.WeaponOptions.TracerLines && TracerLines.Count > 0) { T.DrawMaterial.SetPass(0); GL.PushMatrix(); GL.LoadProjectionMatrix(G.MainCamera.projectionMatrix); GL.modelview = G.MainCamera.worldToCameraMatrix; GL.Begin(GL.LINES); for (int i = TracerLines.Count - 1; i > -1; i--) { TracerObject t = TracerLines[i]; if (DateTime.Now - t.ShotTime > TimeSpan.FromSeconds(G.Settings.WeaponOptions.TracerTime)) { TracerLines.Remove(t); continue; } GL.Color(Colors.GetColor("Bullet_Tracer_Color")); GL.Vertex(t.PlayerPos); GL.Vertex(t.HitPos); } GL.End(); GL.PopMatrix(); } #endregion #region Damage Indicators if (G.Settings.WeaponOptions.DamageIndicators && DamageIndicators.Count > 0) { T.DrawMaterial.SetPass(0); for (int i = DamageIndicators.Count - 1; i > -1; i--) { IndicatorObject t = DamageIndicators[i]; if (DateTime.Now - t.ShotTime > TimeSpan.FromSeconds(3)) { DamageIndicators.Remove(t); continue; } GUI.color = Color.red; Vector3 pos = G.MainCamera.WorldToScreenPoint(t.HitPos + new Vector3(0, 1, 0)); pos.y = Screen.height - pos.y; if (pos.z >= 0) { GUIStyle style = GUI.skin.label; style.alignment = TextAnchor.MiddleCenter; Vector2 size = style.CalcSize(new GUIContent($"<b>{t.Damage}</b>")); T.DrawOutlineLabel(new Vector2(pos.x - size.x / 2, pos.y - ((float)(DateTime.Now - t.ShotTime).TotalSeconds * 10)), Color.red, Color.black, $"<b>{t.Damage}</b>"); style.alignment = TextAnchor.MiddleLeft; } GUI.color = Main.GUIColor; } } #endregion } } }