From dec27d16425d427df8c3640d645e160b64cff1de Mon Sep 17 00:00:00 2001 From: Jens Pitkanen Date: Wed, 7 Aug 2019 22:03:03 +0300 Subject: [PATCH] Fix camera sizing and randomly rotate blood particles on spawn --- Assets/Scenes/MainScene.unity | 16 ++++++++++++++++ Assets/Scripts/Effects/BloodParticle.cs | 2 ++ Assets/Scripts/Util/CameraHelper.cs | 12 ++++++++++-- ProjectSettings/ProjectSettings.asset | 4 ++-- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 98e94ea..a0a1ad6 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -19548,6 +19548,7 @@ GameObject: - component: {fileID: 963194227} - component: {fileID: 963194226} - component: {fileID: 963194229} + - component: {fileID: 963194230} m_Layer: 0 m_Name: Main Camera m_TagString: MainCamera @@ -19636,6 +19637,21 @@ MonoBehaviour: ShakeHandle: {fileID: 139250670} CameraTransform: {fileID: 963194228} Camera: {fileID: 963194227} +--- !u!114 &963194230 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5192955d4df7c5448a32cf7720b9ce66, type: 3} + m_Name: + m_EditorClassIdentifier: + Camera: {fileID: 963194227} + PixelScale: 3 + PixelsPerUnit: 32 --- !u!1001 &982353464 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Effects/BloodParticle.cs b/Assets/Scripts/Effects/BloodParticle.cs index 673df37..39d6413 100644 --- a/Assets/Scripts/Effects/BloodParticle.cs +++ b/Assets/Scripts/Effects/BloodParticle.cs @@ -20,6 +20,8 @@ namespace Saltosion.OneWeapon { GetsStuck = Random.value > 0.5; if (Sprites.Length > 0) { Renderer.sprite = Sprites[(int)(Random.value * int.MaxValue) % Sprites.Length]; + Renderer.flipX = Random.value < 0.5; + Renderer.flipY = Random.value < 0.5; } } diff --git a/Assets/Scripts/Util/CameraHelper.cs b/Assets/Scripts/Util/CameraHelper.cs index 06f51c7..69fa57a 100644 --- a/Assets/Scripts/Util/CameraHelper.cs +++ b/Assets/Scripts/Util/CameraHelper.cs @@ -4,10 +4,18 @@ using UnityEngine; namespace Saltosion.OneWeapon { public class CameraHelper : MonoBehaviour { - private void Start() { - } + public Camera Camera; + [Range(1, 4)] + public int PixelScale = 2; + public int PixelsPerUnit = 32; + + private int LastHeight = -1; private void Update() { + if (LastHeight != Screen.height) { + Camera.orthographicSize = Screen.height * ((0.5f / PixelsPerUnit) / PixelScale); + LastHeight = Screen.height; + } } } } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 00cd8ba..4d321af 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -81,7 +81,7 @@ PlayerSettings: bakeCollisionMeshes: 0 forceSingleInstance: 0 useFlipModelSwapchain: 1 - resizableWindow: 0 + resizableWindow: 1 useMacAppStoreValidation: 0 macAppStoreCategory: public.app-category.games gpuSkinning: 1 @@ -120,7 +120,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 1.0 + bundleVersion: 2.0-Indev preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0