public void SetCrosshairType(CrosshairStyle c) { if (crosshairStyle != c) { crosshairStyle = c; } }
public void DrawCrosshair(CrosshairStyle style, float x, float y, float size, float stroke, Direct2DColor color) { _sharedBrush.Color = color; if (style == CrosshairStyle.Dot) { FillCircle(x, y, size, color); } else if (style == CrosshairStyle.Plus) { DrawLine(x - size, y, x + size, y, stroke, color); DrawLine(x, y - size, x, y + size, stroke, color); } else if (style == CrosshairStyle.Cross) { DrawLine(x - size, y - size, x + size, y + size, stroke, color); DrawLine(x + size, y - size, x - size, y + size, stroke, color); } else if (style == CrosshairStyle.Gap) { DrawLine(x - size - stroke, y, x - stroke, y, stroke, color); DrawLine(x + size + stroke, y, x + stroke, y, stroke, color); DrawLine(x, y - size - stroke, x, y - stroke, stroke, color); DrawLine(x, y + size + stroke, x, y + stroke, stroke, color); } else if (style == CrosshairStyle.Diagonal) { DrawLine(x - size, y - size, x + size, y + size, stroke, color); DrawLine(x + size, y - size, x - size, y + size, stroke, color); } else if (style == CrosshairStyle.Swastika) { RawVector2 first = new RawVector2(x - size, y); RawVector2 second = new RawVector2(x + size, y); RawVector2 third = new RawVector2(x, y - size); RawVector2 fourth = new RawVector2(x, y + size); RawVector2 haken_1 = new RawVector2(third.X + size, third.Y); RawVector2 haken_2 = new RawVector2(second.X, second.Y + size); RawVector2 haken_3 = new RawVector2(fourth.X - size, fourth.Y); RawVector2 haken_4 = new RawVector2(first.X, first.Y - size); _device.DrawLine(first, second, _sharedBrush, stroke); _device.DrawLine(third, fourth, _sharedBrush, stroke); _device.DrawLine(third, haken_1, _sharedBrush, stroke); _device.DrawLine(second, haken_2, _sharedBrush, stroke); _device.DrawLine(fourth, haken_3, _sharedBrush, stroke); _device.DrawLine(first, haken_4, _sharedBrush, stroke); } }
private IEnumerator DelayApply() { updateGraphicsFrameCount = Time.frameCount; yield return(null); //Wait for one frame before applying. QualitySettings.SetQualityLevel(shadowQuality); if (setFS) { Screen.fullScreen = (fullScreen == "Fullscreen"); if (Screen.currentResolution.width != screenWidth || Screen.currentResolution.height != screenHeight || Screen.fullScreen != (fullScreen == "Fullscreen")) { Screen.SetResolution(screenWidth, screenHeight, fullScreen == "Fullscreen"); } } setFS = true; QualitySettings.masterTextureLimit = textureQuality; QualitySettings.vSyncCount = (vsync == "Enabled") ? 1 : 0; if (crosshairStyle == "Dynamic") { crossStyle = CrosshairStyle.Dynamic; } else if (crosshairStyle == "Static") { crossStyle = CrosshairStyle.Static; } else if (crosshairStyle == "Disabled") { crossStyle = CrosshairStyle.Disabled; } if (aniso == "Disable") { QualitySettings.anisotropicFiltering = AnisotropicFiltering.Disable; } else if (aniso == "Enable") { QualitySettings.anisotropicFiltering = AnisotropicFiltering.Enable; } QualitySettings.shadowDistance = shadowDistance; AudioListener.volume = soundVolume; foreach (Terrain terrain in ter) { terrain.heightmapPixelError = terrainMeshDetail; terrain.detailObjectDistance = vegetationDistance; terrain.detailObjectDensity = vegetationDensity; terrain.treeBillboardDistance = terrainTreeDrawDistance; terrain.treeMaximumFullLODCount = terrainMaxTrees; } if (GeneralVariables.uicIsActive) { GeneralVariables.uiController.UpdateHUD((enableHUD == 1) ? true : false); } UpdatePostProcess(); }
void Update() { if (GeneralVariables.playerRef == null) { foreach (UISprite sprite in crossSprites) { sprite.alpha = 0f; } return; } crossStyle = GameSettings.settingsController.crossStyle; float empDistortCrosshair = (pe.hasEMP) ? (Mathf.PerlinNoise(Mathf.PingPong(Time.time * 25f, 200f), 0f) * 35f) : 0f; if (crossStyle == CrosshairStyle.Dynamic) { GunController curGun = wm.currentGC; if (curGun != null) { if (curGun.crosshairsEnabled && !pm.sprinting && !dm.terminalVelocity) { isEnabled = (!ac.isAiming && !curGun.reloading && !acs.clipping && !pm.onLadder); if (!ac.isTransitioning && !ac.isAiming) { baseSpread = curGun.spreadReal * offsetMultiplier; baseSpread *= (70f / GameSettings.settingsController.FOV); } } else { isEnabled = false; } } else { isEnabled = !pm.sprinting; baseSpread = defaultSpacing; } if (isEnabled && !pm.sprinting && !dm.animationIsPlaying) { growthSpreadAnim = Mathf.Lerp(growthSpreadAnim, 0f, Time.deltaTime * 9f); } else { growthSpreadAnim = Mathf.Lerp(growthSpreadAnim, 30f, Time.deltaTime * 9f); } joltAnim = Mathf.Lerp(joltAnim, 0f, Time.deltaTime * 7f); } else if (crossStyle == CrosshairStyle.Static) { isEnabled = !pm.sprinting && !ac.isAiming; baseSpread = defaultSpacing; growthSpreadAnim = 0f; joltAnim = 0f; } else { foreach (UISprite sprite in crossSprites) { sprite.alpha = 0f; } baseSpread = defaultSpacing; growthSpreadAnim = 0f; joltAnim = 0f; return; } realSpacing = (baseSpread + guiBaseOffset) + joltAnim + growthSpreadAnim + empDistortCrosshair; hitIndicatorOffset = realSpacing - ((!ac.isAiming) ? growthSpreadAnim : 0f); float xEMP = ((pe.hasEMP) ? (1f - Random.value * 2f) * 75f * Random.value : 0f); float yEMP = ((pe.hasEMP) ? (1f - Random.value * 2f) * 75f * Random.value : 0f); leftCross.cachedTrans.localPosition = new Vector3(-realSpacing + xEMP, yEMP, 0f); rightCross.cachedTrans.localPosition = new Vector3(realSpacing + xEMP, yEMP, 0f); upCross.cachedTrans.localPosition = new Vector3(xEMP, realSpacing + yEMP, 0f); downCross.cachedTrans.localPosition = new Vector3(xEMP, -realSpacing + yEMP, 0f); float alpha = (isEnabled && !dm.animationIsPlaying && !RestrictionManager.restricted) ? opacity : 0f; foreach (UISprite sprite in crossSprites) { if (pe.hasEMP) { sprite.alpha = Random.value * alpha; } else { sprite.alpha = Mathf.MoveTowards(sprite.alpha, alpha, Time.unscaledDeltaTime * opacity * 10f); } } }
private void DrawWeaponBase() { EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Window"); EditorGUI.BeginChangeCheck(); int weaponId = EditorGUILayout.IntField("Weapon ID", m_Target.weaponId); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed Weapon ID"); m_Target.weaponId = weaponId; } EditorGUI.BeginChangeCheck(); string weaponName = EditorGUILayout.TextField("Weapon Name", m_Target.weaponName); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed Weapon Name"); m_Target.weaponName = weaponName; } if (m_Target.weaponName.Length > 0) { m_Target.gameObject.name = m_Target.weaponName; } else { m_Target.gameObject.name = "Weapon Name"; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Weapon Icon"); EditorGUI.BeginChangeCheck(); Texture2D weaponIcon = (Texture2D)EditorGUILayout.ObjectField(m_Target.weaponIcon, typeof(Texture2D), false); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed Weapon Icon"); m_Target.weaponIcon = weaponIcon; } EditorGUILayout.EndHorizontal(); EditorGUI.BeginChangeCheck(); GameObject droppablePrefab = (GameObject)EditorGUILayout.ObjectField("Droppable Prefab", m_Target.droppablePrefab, typeof(GameObject), false); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed Droppable Prefab"); m_Target.droppablePrefab = droppablePrefab; } EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); float weight = EditorGUILayout.Slider("Weapon Weight", m_Target.weight, 0, 2.5f); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed Weapon Weight"); m_Target.weight = weight; } EditorGUI.BeginChangeCheck(); CrosshairStyle crosshairStyle = (CrosshairStyle)EditorGUILayout.EnumPopup("Crosshair Style", m_Target.crosshairStyle); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed Crosshair Style"); m_Target.crosshairStyle = crosshairStyle; } EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); bool melee = EditorGUILayout.Toggle("Melee Attack", m_Target.melee); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Disabe/Enable Melee Attack"); m_Target.melee = melee; } EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); Camera mainCamera = (Camera)EditorGUILayout.ObjectField("Main Camera", m_Target.mainCamera, typeof(Camera), true); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed Main Camera"); m_Target.mainCamera = mainCamera; } EditorGUI.BeginChangeCheck(); MoveController controller = (MoveController)EditorGUILayout.ObjectField("Player", m_Target.controller, typeof(MoveController), true); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed Player"); m_Target.controller = controller; } EditorGUI.BeginChangeCheck(); CameraAnimations cameraAnimations = (CameraAnimations)EditorGUILayout.ObjectField("Camera Animations", m_Target.cameraAnimations, typeof(CameraAnimations), true); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed Camera Animations"); m_Target.cameraAnimations = cameraAnimations; } EditorGUI.BeginChangeCheck(); PlayerUI ui = (PlayerUI)EditorGUILayout.ObjectField("UI", m_Target.UI, typeof(PlayerUI), true); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed UI"); m_Target.UI = ui; } EditorGUI.BeginChangeCheck(); BulletMarkManager bulletMark = (BulletMarkManager)EditorGUILayout.ObjectField("Bullet Marks Manager", m_Target.bulletMark, typeof(BulletMarkManager), true); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Bullet Marks Manager"); m_Target.bulletMark = bulletMark; } EditorGUI.BeginChangeCheck(); WeaponsManager weaponManager = (WeaponsManager)EditorGUILayout.ObjectField("Weapons Manager", m_Target.weaponManager, typeof(WeaponsManager), true); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Bullet Weapons Manager"); m_Target.weaponManager = weaponManager; } EditorGUILayout.Space(); if (GUILayout.Button("Enable / Disabe")) { if (hide) { hide = false; } else { hide = true; } m_Target.DisableRenders(hide); } EditorGUILayout.EndVertical(); }