Skip to content

Commit 6a0b8f0

Browse files
author
David Arutiunian
committed
💄 Make Triangles bigger on first level
1 parent aee6fc1 commit 6a0b8f0

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

Assets/Scenes/MainScene.unity

+1-1
Original file line numberDiff line numberDiff line change
@@ -1905,7 +1905,7 @@ MonoBehaviour:
19051905
m_StartCorner: 0
19061906
m_StartAxis: 1
19071907
m_CellSize: {x: 1, y: 1}
1908-
m_Spacing: {x: 0.7, y: 1}
1908+
m_Spacing: {x: 1, y: 1}
19091909
m_Constraint: 0
19101910
m_ConstraintCount: 3
19111911
--- !u!224 &718848809

Assets/Scripts/GameStore.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public class GameStore : MonoBehaviour
1717
public static readonly string INITIAL_REMEMBER_TEXT = "Remember";
1818
public static readonly string AGAIN_REMEMBER_TEXT = "Remember Again!";
1919

20-
public int score { get; private set; } = 0; public int weight { get; private set; } = MIN_WEIGHT;
20+
public int score { get; private set; } = 0;
21+
public int weight { get; private set; } = MIN_WEIGHT;
2122
public int step { get; private set; } = 0;
2223
public int timer { get; private set; } = INITIAL_TIMER;
2324
public bool win { get; private set; } = false;

Assets/Scripts/PrepareState.cs

+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Linq;
33
using UnityEngine;
4+
using UnityEngine.UI;
45

56
public class PrepareState : BaseGameState
67
{
@@ -16,6 +17,8 @@ protected override void DoOnStart()
1617
game.GameOverlay.SetActive(true);
1718
game.ToolbarController.ShowTimer();
1819

20+
SetGridLayoutSpacing();
21+
1922
GameEvents.instance.OnCountEnd += DoOnCountEnd;
2023

2124
Restart();
@@ -63,4 +66,16 @@ private void DoOnCountEnd()
6366
GameStore.instance.SetReady(true);
6467
GameEvents.instance.TriggerPrepareEnd();
6568
}
69+
70+
private void SetGridLayoutSpacing()
71+
{
72+
if (GameStore.instance.GetAbsoluteWeight() == 0)
73+
{
74+
game.GameGrid.GetComponent<GridLayoutGroup>().spacing = new Vector2(1.3f, 1f);
75+
}
76+
else
77+
{
78+
game.GameGrid.GetComponent<GridLayoutGroup>().spacing = new Vector2(0.7f, 1f);
79+
}
80+
}
6681
}

Assets/Scripts/TriangleGenerator.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,17 @@ private GameObject[] CreateTrianglesFor(Rotation[] rotations)
3737
private GameObject CreateTriangle(Vector3 pos, Quaternion rot)
3838
{
3939
var triangle = GameObject.Instantiate(template, pos, rot, parent);
40-
triangle.transform.localScale += new Vector3(1.5f, 1.5f, 1);
40+
triangle.transform.localScale += GetTriangleScale();
4141
return triangle;
4242
}
4343

44+
private Vector3 GetTriangleScale() {
45+
if (GameStore.instance.GetAbsoluteWeight() == 0) {
46+
return new Vector3(2f, 2f, 1f);
47+
}
48+
return new Vector3(1.5f, 1.5f, 1f);
49+
}
50+
4451
private void SortTriangles(GameObject[] triangles)
4552
{
4653
Array.Sort(triangles, CompareNames);

0 commit comments

Comments
 (0)