Fixed small issues found in playtesting
This commit is contained in:
33
Assets/Scripts/CamRatioFixer.cs
Normal file
33
Assets/Scripts/CamRatioFixer.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class CamRatioFixer : MonoBehaviour
|
||||
{
|
||||
public Camera cam;
|
||||
|
||||
void Update()
|
||||
{
|
||||
float targetAspect = 16f / 9f;
|
||||
float windowAspect = (float)Screen.width / Screen.height;
|
||||
float scale = windowAspect / targetAspect;
|
||||
|
||||
if (scale < 1f)
|
||||
{
|
||||
cam.rect = new Rect(
|
||||
0,
|
||||
(1f - scale) / 2f,
|
||||
1f,
|
||||
scale
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
float width = 1f / scale;
|
||||
cam.rect = new Rect(
|
||||
(1f - width) / 2f,
|
||||
0,
|
||||
width,
|
||||
1f
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/CamRatioFixer.cs.meta
Normal file
11
Assets/Scripts/CamRatioFixer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d33e1862ff5809499d3187e38cf80a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,11 +7,13 @@ namespace InterfaceOff.WorldScene
|
||||
public Transform HealthBarObject;
|
||||
public WindowSpawner Spawner;
|
||||
public LifeThingTrackerThing Thing;
|
||||
|
||||
|
||||
public int Health { get; private set; }
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float scale = ((20 - Thing.HitsTaken) - Spawner.SpawnedWindowCount) * 5f;
|
||||
scale = Mathf.Clamp(scale, 0f, Mathf.Infinity);
|
||||
Health = ((20 - Thing.HitsTaken) - Spawner.SpawnedWindowCount);
|
||||
float scale = Mathf.Clamp(Health * 5f, 0f, Mathf.Infinity);
|
||||
|
||||
if (!Spawner.AutoSpawn)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace InterfaceOff.WorldScene
|
||||
[SerializeField] private GameObject MovingObject;
|
||||
[SerializeField] private AudioClip[] AudioClips;
|
||||
[SerializeField] private AudioSource PlayerAudioSource;
|
||||
[SerializeField] private HealthBar HealthTracker;
|
||||
|
||||
public static void PlayRandomErrorSound()
|
||||
{
|
||||
@@ -61,7 +62,7 @@ namespace InterfaceOff.WorldScene
|
||||
/* Iterates the frame index */
|
||||
FrameIndex = (FrameIndex + 1) % (Frames.Length - 2);
|
||||
|
||||
if (DeathIndices.Contains(FrameIndex) && ActiveWindowSpawner.SpawnedWindowCount > MAX_WINDOWS)
|
||||
if (DeathIndices.Contains(FrameIndex) && HealthTracker.Health <= 0)
|
||||
{
|
||||
ActiveWindowSpawner.StartEndSequence();
|
||||
PlayerAlive = false;
|
||||
|
||||
@@ -66,8 +66,8 @@ namespace InterfaceOff
|
||||
|
||||
public void DestroyWindow()
|
||||
{
|
||||
StartCoroutine(routine: DeathSequence());
|
||||
Creator.AlertOfDespawnedWindow();
|
||||
StartCoroutine(routine: DeathSequence());
|
||||
}
|
||||
|
||||
private IEnumerator DeathSequence()
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace InterfaceOff
|
||||
|
||||
public void AlertOfDespawnedWindow() => SpawnedWindowCount--;
|
||||
|
||||
private int SpawnyThingyMajig = 9000; // Sky chose dis
|
||||
private int SpawnyThingyMajig = 40 * 25; // Sky chose dis
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
@@ -106,7 +106,8 @@ namespace InterfaceOff
|
||||
if (SpawnyThingyMajig == 0)
|
||||
{
|
||||
PasswordField.SetActive(true);
|
||||
SpawnyThingyMajig = Random.Range(2000, 10000);
|
||||
SpawnyThingyMajig = Random.Range(40 * 15, 40 * 20);
|
||||
Debug.Log($"[{Time.timeSinceLevelLoad}]");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user