Skip to content

Commit

Permalink
compo
Browse files Browse the repository at this point in the history
  • Loading branch information
thquinn committed Jan 8, 2023
1 parent a9a07f1 commit 6c2b496
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Assets/Code/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static class Util {
{ 10, new FruitInfo("Loquat", HexToColor("#EC983C"), 40,
"You discovered temporal secrets! You can make time pass faster.",
(state) => {
state.progression.timeScaleMaxIndex++;
state.progression.timeScaleMaxIndex = Mathf.Min(state.progression.timeScaleMaxIndex + 1, Progression.TIMESCALES.Length - 1);
}) },
{ 11, new FruitInfo("Raspberry", HexToColor("#E30B5C"), 33,
"You discovered half of a victory...",
Expand Down
2 changes: 1 addition & 1 deletion Assets/Materials/TickDisc.mat
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Material:
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Revealed: 0.97280884
- _Revealed: 0.43518484
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
Expand Down
106 changes: 105 additions & 1 deletion Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -4528,6 +4528,109 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 733785907}
m_CullTransparentMesh: 1
--- !u!1 &742761909
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 742761910}
- component: {fileID: 742761914}
- component: {fileID: 742761913}
- component: {fileID: 742761912}
- component: {fileID: 742761911}
m_Layer: 5
m_Name: Fade
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &742761910
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 742761909}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1432220892}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!225 &742761911
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 742761909}
m_Enabled: 1
m_Alpha: 0
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!114 &742761912
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 742761909}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: db1299235755e684f9b8842a8084889f, type: 3}
m_Name:
m_EditorClassIdentifier:
canvasGroup: {fileID: 742761911}
--- !u!114 &742761913
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 742761909}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &742761914
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 742761909}
m_CullTransparentMesh: 1
--- !u!1 &750935473
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -7328,6 +7431,7 @@ RectTransform:
- {fileID: 1367402756}
- {fileID: 1796849418}
- {fileID: 1339351967}
- {fileID: 742761910}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -8401,7 +8505,7 @@ RectTransform:
m_GameObject: {fileID: 1796849417}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 0.66, y: 0.66, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 900754411}
Expand Down
17 changes: 6 additions & 11 deletions Assets/Scripts/BoardManagerScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,16 @@ public class BoardManagerScript : MonoBehaviour {
state.GetMoney(10000000);
}
if (Input.GetKeyDown(KeyCode.F2)) {
Time.timeScale += 1;
state.progression.timeScaleMaxIndex = Progression.TIMESCALES.Length - 1;
}
if (Input.GetKeyDown(KeyCode.F3)) {
state.progression.researchFlags.Add(ResearchFlags.ApproximateResearch);
state.progression.researchFlags.Add(ResearchFlags.ConditionalFlingers);
state.progression.researchFlags.Add(ResearchFlags.PrimeBonus);
state.progression.researchFlags.Add(ResearchFlags.SuperLemon);
}
if (Input.GetKeyDown(KeyCode.F4)) {
state.SpawnHalfVictory();
}
if (Input.GetKeyDown(KeyCode.F5)) {
state.StoreGadgetType(EntitySubtype.Blocker);
state.StoreGadgetType(EntitySubtype.Flinger);
state.StoreGadgetType(EntitySubtype.Fuser);
state.StoreGadgetType(EntitySubtype.Lab);
state.StoreGadgetType(EntitySubtype.Storage);
}
if (Input.GetKeyDown(KeyCode.F6)) {
if (Input.GetKeyDown(KeyCode.F4)) {
state.progression.SpawnEpoch();
EntityCheck();
}
Expand Down
20 changes: 20 additions & 0 deletions Assets/Scripts/FadeScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FadeScript : MonoBehaviour
{
public CanvasGroup canvasGroup;

void Start() {
if (!Application.isEditor) {
canvasGroup.alpha = 1;
}
}

void Update() {
if (Time.frameCount > 10) {
canvasGroup.alpha -= Time.deltaTime * 3;
}
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/FadeScript.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Assets/Scripts/GadgetRowScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class GadgetRowScript : MonoBehaviour
foreach (Vector2Int massAndAmount in cost.massesAndAmounts) {
Instantiate(prefabFruitCostRow, rectTransformCostSection).GetComponent<FruitCostRowScript>().Init(massAndAmount.x, (ulong) massAndAmount.y);
}
LayoutRebuilder.ForceRebuildLayoutImmediate(rectTransformCostSection);
}
}
}
22 changes: 9 additions & 13 deletions Assets/Scripts/UIScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class UIScript : MonoBehaviour
{
static Dictionary<ProgressionPhase, string> TUTORIAL_STRINGS = new Dictionary<ProgressionPhase, string>() {
{ ProgressionPhase.Start, "Right-click-drag to pan, scroll wheel to zoom.\nDrag apples next to the Market to sell them." },
{ ProgressionPhase.Start, "Drag apples next to the Market to sell them.\nRight-click-drag to pan, scroll wheel to zoom." },
{ ProgressionPhase.TutorialFlinger, "Click the button in the lower right and drag a Flinger onto the highlighted spot." },
{ ProgressionPhase.TutorialBlocker, "Place a Blocker in the highlighted spot, then use another Flinger to reach the new Market." },
{ ProgressionPhase.SecondTree, "Sell apples and pears." },
Expand All @@ -30,7 +30,6 @@ public class UIScript : MonoBehaviour
float lastMoney, vMoney;
float vAlphaMoney, vAlphaResearch, vAlphaFruit, vAlphaGadgetDrawerButton;
Dictionary<int, FruitCostRowScript> massToFruitRowScripts;
float lastTimeScale;
Research lastResearch;

void Start() {
Expand Down Expand Up @@ -92,17 +91,14 @@ public class UIScript : MonoBehaviour
tmpTutorial.text = TUTORIAL_STRINGS.ContainsKey(state.progression.phase) ? TUTORIAL_STRINGS[state.progression.phase] : "";
// Update buttons.
imageTickDisc.material.SetFloat("_Revealed", Time.time % 1);
if (Time.timeScale != lastTimeScale) {
bool showTimeControls = state.progression.timeScaleMinIndex != state.progression.timeScaleMaxIndex;
bool showSlowDown = showTimeControls && boardManagerScript.timescaleIndex > state.progression.timeScaleMinIndex;
bool showSpeedUp = showTimeControls && boardManagerScript.timescaleIndex < state.progression.timeScaleMaxIndex;
canvasGroupSlowDown.alpha = showSlowDown ? 1 : 0;
canvasGroupSpeedUp.alpha = showSpeedUp ? 1 : 0;
tmpTimescale.text = Time.timeScale.ToString();
canvasGroupTickRate.alpha = Time.timeScale == 1 ? 0 : 1;
LayoutRebuilder.ForceRebuildLayoutImmediate(canvasGroupTickRate.transform as RectTransform);
lastTimeScale = Time.timeScale;
}
bool showTimeControls = state.progression.timeScaleMinIndex != state.progression.timeScaleMaxIndex;
bool showSlowDown = showTimeControls && boardManagerScript.timescaleIndex > state.progression.timeScaleMinIndex;
bool showSpeedUp = showTimeControls && boardManagerScript.timescaleIndex < state.progression.timeScaleMaxIndex;
canvasGroupSlowDown.alpha = showSlowDown ? 1 : 0;
canvasGroupSpeedUp.alpha = showSpeedUp ? 1 : 0;
tmpTimescale.text = Time.timeScale.ToString();
canvasGroupTickRate.alpha = Time.timeScale == 1 ? 0 : 1;
LayoutRebuilder.ForceRebuildLayoutImmediate(canvasGroupTickRate.transform as RectTransform);
canvasGroupCleanUpTutorial.alpha = state.progression.phase == ProgressionPhase.TutorialBlocker ? 1 : 0;
}
}

0 comments on commit 6c2b496

Please sign in to comment.