From 6a0b8f0721932832a7fabc4f9b7bc3edfcc12e72 Mon Sep 17 00:00:00 2001 From: David Arutiunian Date: Sat, 27 Jun 2020 12:39:43 +0300 Subject: [PATCH] :lipstick: Make Triangles bigger on first level --- Assets/Scenes/MainScene.unity | 2 +- Assets/Scripts/GameStore.cs | 3 ++- Assets/Scripts/PrepareState.cs | 15 +++++++++++++++ Assets/Scripts/TriangleGenerator.cs | 9 ++++++++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 8e52667..d5c8630 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -1905,7 +1905,7 @@ MonoBehaviour: m_StartCorner: 0 m_StartAxis: 1 m_CellSize: {x: 1, y: 1} - m_Spacing: {x: 0.7, y: 1} + m_Spacing: {x: 1, y: 1} m_Constraint: 0 m_ConstraintCount: 3 --- !u!224 &718848809 diff --git a/Assets/Scripts/GameStore.cs b/Assets/Scripts/GameStore.cs index c753de9..7d73aa4 100644 --- a/Assets/Scripts/GameStore.cs +++ b/Assets/Scripts/GameStore.cs @@ -17,7 +17,8 @@ public class GameStore : MonoBehaviour public static readonly string INITIAL_REMEMBER_TEXT = "Remember"; public static readonly string AGAIN_REMEMBER_TEXT = "Remember Again!"; - public int score { get; private set; } = 0; public int weight { get; private set; } = MIN_WEIGHT; + public int score { get; private set; } = 0; + public int weight { get; private set; } = MIN_WEIGHT; public int step { get; private set; } = 0; public int timer { get; private set; } = INITIAL_TIMER; public bool win { get; private set; } = false; diff --git a/Assets/Scripts/PrepareState.cs b/Assets/Scripts/PrepareState.cs index bf6563f..dba2e7d 100644 --- a/Assets/Scripts/PrepareState.cs +++ b/Assets/Scripts/PrepareState.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using UnityEngine; +using UnityEngine.UI; public class PrepareState : BaseGameState { @@ -16,6 +17,8 @@ protected override void DoOnStart() game.GameOverlay.SetActive(true); game.ToolbarController.ShowTimer(); + SetGridLayoutSpacing(); + GameEvents.instance.OnCountEnd += DoOnCountEnd; Restart(); @@ -63,4 +66,16 @@ private void DoOnCountEnd() GameStore.instance.SetReady(true); GameEvents.instance.TriggerPrepareEnd(); } + + private void SetGridLayoutSpacing() + { + if (GameStore.instance.GetAbsoluteWeight() == 0) + { + game.GameGrid.GetComponent().spacing = new Vector2(1.3f, 1f); + } + else + { + game.GameGrid.GetComponent().spacing = new Vector2(0.7f, 1f); + } + } } diff --git a/Assets/Scripts/TriangleGenerator.cs b/Assets/Scripts/TriangleGenerator.cs index 7f62b11..a22e25c 100644 --- a/Assets/Scripts/TriangleGenerator.cs +++ b/Assets/Scripts/TriangleGenerator.cs @@ -37,10 +37,17 @@ private GameObject[] CreateTrianglesFor(Rotation[] rotations) private GameObject CreateTriangle(Vector3 pos, Quaternion rot) { var triangle = GameObject.Instantiate(template, pos, rot, parent); - triangle.transform.localScale += new Vector3(1.5f, 1.5f, 1); + triangle.transform.localScale += GetTriangleScale(); return triangle; } + private Vector3 GetTriangleScale() { + if (GameStore.instance.GetAbsoluteWeight() == 0) { + return new Vector3(2f, 2f, 1f); + } + return new Vector3(1.5f, 1.5f, 1f); + } + private void SortTriangles(GameObject[] triangles) { Array.Sort(triangles, CompareNames);