Skip to content

Commit

Permalink
Few fixes before release
Browse files Browse the repository at this point in the history
Fix: shafts are too small
Fix: settings animation executes scripts too late
  • Loading branch information
Carapacik committed May 30, 2021
1 parent f3f448b commit 1a8efc1
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 44 deletions.
9 changes: 8 additions & 1 deletion Assets/Animations/NewSettingsBack.anim
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,11 @@ AnimationClip:
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []
m_Events:
- time: 0.33333334
functionName: OnClose
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
2 changes: 1 addition & 1 deletion Assets/Animations/NewSettingsClosed.anim
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ AnimationClip:
m_HasMotionFloatCurves: 0
m_Events:
- time: 0
functionName: OnClose
functionName: HideSettingsObject
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
Expand Down
3 changes: 2 additions & 1 deletion Assets/Resources/Prefabs/LevelElements/Shaft.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Transform:
m_GameObject: {fileID: 6033758439681269262}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 18, y: 18, z: 1}
m_LocalScale: {x: 72, y: 72, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
Expand All @@ -43,6 +43,7 @@ SpriteRenderer:
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scenes/Lvl8.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1977,6 +1977,14 @@ PrefabInstance:
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6033758440217019135, guid: 12acff1183807904eaa9f7813bebed0e, type: 3}
propertyPath: m_LocalScale.x
value: 72
objectReference: {fileID: 0}
- target: {fileID: 6033758440217019135, guid: 12acff1183807904eaa9f7813bebed0e, type: 3}
propertyPath: m_LocalScale.y
value: 72
objectReference: {fileID: 0}
- target: {fileID: 6033758440217019135, guid: 12acff1183807904eaa9f7813bebed0e, type: 3}
propertyPath: m_LocalPosition.x
value: 131
Expand Down
14 changes: 4 additions & 10 deletions Assets/Scripts/CanvasButtons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,11 @@ private void Start()
{
var sound = PlayerPrefs.GetString("Sound");
if (sound == "") PlayerPrefs.SetString("Sound", "ON");
if (sound == "OFF" && gameObject.name == "SoundButton")
GetComponent<Image>().sprite = soundOff;

if (sound == "OFF" && gameObject.name == "SoundButton") GetComponent<Image>().sprite = soundOff;
var music = PlayerPrefs.GetString("Music");
if (music == "") PlayerPrefs.SetString("Music", "ON");
if (music == "OFF" && gameObject.name == "MusicButton")
GetComponent<Image>().sprite = musicOff;

if (PlayerPrefs.GetInt("LastCompletedLevel") == 12)
PlayerPrefs.SetInt("LastCompletedLevel", 0);
if (music == "OFF" && gameObject.name == "MusicButton") GetComponent<Image>().sprite = musicOff;
if (PlayerPrefs.GetInt("LastCompletedLevel") == 12) PlayerPrefs.SetInt("LastCompletedLevel", 0);
PlayerPrefs.Save();
}

Expand Down Expand Up @@ -76,7 +71,6 @@ public void SwitchMusic()

public void PlayClickSound()
{
if (PlayerPrefs.GetString("Sound") != "OFF")
GetComponent<AudioSource>().Play();
if (PlayerPrefs.GetString("Sound") != "OFF") GetComponent<AudioSource>().Play();
}
}
2 changes: 0 additions & 2 deletions Assets/Scripts/CanvasSafeArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ private void Update()
private void ApplySafeArea()
{
if (safeAreaRect == null) return;

var safeArea = Screen.safeArea;
var anchorMin = safeArea.position;
var anchorMax = safeArea.position + safeArea.size;
Expand All @@ -39,7 +38,6 @@ private void ApplySafeArea()
anchorMin.y /= pixelRect.height;
anchorMax.x /= pixelRect.width;
anchorMax.y /= pixelRect.height;

safeAreaRect.anchorMin = anchorMin;
safeAreaRect.anchorMax = anchorMax;
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Hint.cs → Assets/Scripts/HintEasy.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UnityEngine;

public class Hint : MonoBehaviour
public class HintEasy : MonoBehaviour
{
public void ShowHint()
{
Expand Down
File renamed without changes.
6 changes: 2 additions & 4 deletions Assets/Scripts/LevelMenuController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ public void Update()
var lvlName = item.transform.GetChild(1).transform;
if (highLvl >= int.Parse(lvlName.GetComponent<TextMeshProUGUI>().text))
{
item.transform.GetChild(0).transform.GetComponent<Image>().color =
new Color(1, 1, 1, 0.9f);
lvlName.GetComponent<TextMeshProUGUI>().color =
new Color(0.3f, 0.85f, 0.5f, 0.9f);
item.transform.GetChild(0).transform.GetComponent<Image>().color = new Color(1, 1, 1, .9f);
lvlName.GetComponent<TextMeshProUGUI>().color = new Color(.3f, .85f, .5f, .9f);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions Assets/Scripts/MusicController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ public class MusicController : MonoBehaviour

private void Awake()
{
if (PlayerPrefs.GetString("Music") == "OFF")
gameObject.GetComponent<AudioSource>().enabled = false;
if (PlayerPrefs.GetString("Music") == "OFF") gameObject.GetComponent<AudioSource>().enabled = false;
if (music != null)
{
Destroy(gameObject);
Expand Down
10 changes: 6 additions & 4 deletions Assets/Scripts/SettingsAnimationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ private void Start()
private void OnOpen()
{
ObjectExtension.GetSavedObjects()[0].transform.GetComponent<AudioSource>().pitch = .85f;
foreach (var belt in _belts)
belt.gameObject.GetComponent<SwapBelts>().enabled = false;
foreach (var belt in _belts) belt.gameObject.GetComponent<SwapBelts>().enabled = false;
}

private void OnClose()
{
ObjectExtension.GetSavedObjects()[0].transform.GetComponent<AudioSource>().pitch = 1;
foreach (var belt in _belts)
belt.gameObject.GetComponent<SwapBelts>().enabled = true;
foreach (var belt in _belts) belt.gameObject.GetComponent<SwapBelts>().enabled = true;
}

private void HideSettingsObject()
{
gameObject.SetActive(false);
}
}
4 changes: 1 addition & 3 deletions Assets/Scripts/SwapBelts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ private void Update()
var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
var mousePos2D = new Vector2(mousePos.x, mousePos.y);
var hits = Physics2D.RaycastAll(mousePos2D, Vector2.zero);

foreach (var item in hits)
if (item.collider != null && item.transform.gameObject == gameObject)
{
Expand All @@ -40,7 +39,6 @@ private void ChangeSprite(Sprite sprite)

private void PlaySwitchSound()
{
if (PlayerPrefs.GetString("Sound") != "OFF")
GetComponent<AudioSource>().Play();
if (PlayerPrefs.GetString("Sound") != "OFF") GetComponent<AudioSource>().Play();
}
}
9 changes: 3 additions & 6 deletions Assets/Scripts/VictoryAnimationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ public class VictoryAnimationController : MonoBehaviour
{
private void Awake()
{
if (PlayerPrefs.GetString("Sound") != "OFF")
GetComponent<AudioSource>().Play();
if (PlayerPrefs.GetString("Sound") != "OFF") GetComponent<AudioSource>().Play();
}

private void NextLevel()
{
var currentSceneBuildIndex = SceneManager.GetActiveScene().buildIndex;
if (currentSceneBuildIndex == 13)
LevelMenu();
else
SceneManager.LoadScene(currentSceneBuildIndex + 1);
if (currentSceneBuildIndex == 13) LevelMenu();
else SceneManager.LoadScene(currentSceneBuildIndex + 1);
}

private void LevelMenu()
Expand Down
12 changes: 4 additions & 8 deletions Assets/Scripts/VictoryController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@ private void Start()

private void Update()
{
var correctCounter = _belts.Select(belt => belt.GetComponent<SwapBelts>())
.Count(x => x.isCorrect);
var correctCounter = _belts.Select(belt => belt.GetComponent<SwapBelts>()).Count(x => x.isCorrect);
if (correctCounter == _belts.Length)
{
victoryObject.SetActive(true);
var shafts = GameObject.Find("Shafts").transform;
foreach (Transform shaft in shafts)
shaft.gameObject.GetComponent<RotateShaft>().enabled = true;
foreach (var belt in _belts)
belt.gameObject.GetComponent<SwapBelts>().enabled = false;
foreach (Transform shaft in shafts) shaft.gameObject.GetComponent<RotateShaft>().enabled = true;
foreach (var belt in _belts) belt.gameObject.GetComponent<SwapBelts>().enabled = false;
PlayerPrefs.SetInt("LastCompletedLevel", currentLvl);
if (currentLvl > PlayerPrefs.GetInt("HighestLevel"))
PlayerPrefs.SetInt("HighestLevel", currentLvl);
if (currentLvl > PlayerPrefs.GetInt("HighestLevel")) PlayerPrefs.SetInt("HighestLevel", currentLvl);
PlayerPrefs.Save();
}
}
Expand Down
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 1.0.3
bundleVersion: 1.0.4
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand Down

0 comments on commit 1a8efc1

Please sign in to comment.