Compare commits
8 Commits
alpha-v1.1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01e003422d | ||
|
|
96796e2f0b | ||
|
|
670b8e3473 | ||
|
|
528ed9f413 | ||
|
|
066b3bc958 | ||
|
|
4b08904de9 | ||
|
|
99289ab2ba | ||
| 7b9b296fb8 |
BIN
Assets/Art/Cursor-v2.png
Normal file
BIN
Assets/Art/Cursor-v2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.6 KiB |
130
Assets/Art/Cursor-v2.png.meta
Normal file
130
Assets/Art/Cursor-v2.png.meta
Normal file
@@ -0,0 +1,130 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c17ce7aa80b71a14dbe614fef3b57f73
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -15,45 +15,56 @@ MonoBehaviour:
|
||||
Buildings:
|
||||
- Name: Fan
|
||||
Requirement: 2
|
||||
Type: 0
|
||||
Prefab: {fileID: 8624048914473773482, guid: 1b5c88b3f8d08674a9b15155d6ba9a36,
|
||||
type: 3}
|
||||
- Name: Stair
|
||||
Requirement: 0
|
||||
Type: 0
|
||||
Prefab: {fileID: 2132872997366704715, guid: 3cf8228c3f6c43d4cb60319693b11828,
|
||||
type: 3}
|
||||
- Name: Wall
|
||||
Requirement: 0
|
||||
Type: 0
|
||||
Prefab: {fileID: 1970033728917450326, guid: 3492b31295b69c148bb5a0660e598878,
|
||||
type: 3}
|
||||
- Name: Spring
|
||||
Requirement: 2
|
||||
Type: 0
|
||||
Prefab: {fileID: 8624048914473773482, guid: 6060f6928011bf54dad9c5ef16fb1048,
|
||||
type: 3}
|
||||
- Name: Slicer
|
||||
Requirement: 0
|
||||
Type: 1
|
||||
Prefab: {fileID: 8624048914473773482, guid: d26b0bb551b891e41a14009e6df42019,
|
||||
type: 3}
|
||||
- Name: Presser
|
||||
Requirement: 0
|
||||
Type: 2
|
||||
Prefab: {fileID: 4125748828694197055, guid: a4c4117a8b12b324186385e04c3ede89,
|
||||
type: 3}
|
||||
- Name: Fermenter
|
||||
Requirement: 7
|
||||
Type: 6
|
||||
Prefab: {fileID: 3120737319915985322, guid: b14b2be65581162469cf0e853bdeb24e,
|
||||
type: 3}
|
||||
- Name: Grinder
|
||||
Requirement: 5
|
||||
Type: 4
|
||||
Prefab: {fileID: 4440782070338813379, guid: d25bbc19d1df47f46bef5870a410e4ba,
|
||||
type: 3}
|
||||
- Name: Freezer
|
||||
Requirement: 4
|
||||
Type: 3
|
||||
Prefab: {fileID: 3206624505647374516, guid: eb59ecc0fb9acda43a01511f3f846b1d,
|
||||
type: 3}
|
||||
- Name: Mixer
|
||||
Requirement: 6
|
||||
Type: 5
|
||||
Prefab: {fileID: 1231289801164129672, guid: 42cbc99b07e04604baf02f4ed170aac6,
|
||||
type: 3}
|
||||
- Name: Peeler
|
||||
Requirement: 8
|
||||
Type: 7
|
||||
Prefab: {fileID: 7230295749174351428, guid: d26b3108e619653498c646cb86227d43,
|
||||
type: 3}
|
||||
|
||||
47
Assets/Prefabs/ItemRegistry.prefab
Normal file
47
Assets/Prefabs/ItemRegistry.prefab
Normal file
@@ -0,0 +1,47 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &4528292146240613971
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3666462050572962762}
|
||||
- component: {fileID: 2973243437333469226}
|
||||
m_Layer: 0
|
||||
m_Name: ItemRegistry
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3666462050572962762
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528292146240613971}
|
||||
serializedVersion: 2
|
||||
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: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2973243437333469226
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4528292146240613971}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dcb8b502e5b94a72b37a6e77e4770d05, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Fruitomation::Fruitomation.Game.Items.ItemInfoRegistry
|
||||
SerializedRegistry: {fileID: 11400000, guid: b518751a8b5ee0942af68ec87eeba0c5, type: 2}
|
||||
7
Assets/Prefabs/ItemRegistry.prefab.meta
Normal file
7
Assets/Prefabs/ItemRegistry.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab033116269e1b04a803e8de46580851
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1771,7 +1771,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: c7749f08569b9d442b8952180dae1df7, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: c17ce7aa80b71a14dbe614fef3b57f73, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
@@ -1815,6 +1815,7 @@ MonoBehaviour:
|
||||
SelectedBuildingToBuild:
|
||||
Name:
|
||||
Requirement: 0
|
||||
Type: 0
|
||||
Prefab: {fileID: 0}
|
||||
FlipCurrentBuilding: 0
|
||||
--- !u!58 &1330313879
|
||||
@@ -2157,51 +2158,6 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1511006084}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1618062727
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1618062728}
|
||||
- component: {fileID: 1618062729}
|
||||
m_Layer: 0
|
||||
m_Name: ItemRegistry
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1618062728
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1618062727}
|
||||
serializedVersion: 2
|
||||
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: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1618062729
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1618062727}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dcb8b502e5b94a72b37a6e77e4770d05, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Fruitomation::Fruitomation.Game.Items.ItemInfoRegistry
|
||||
SerializedRegistry: {fileID: 11400000, guid: b518751a8b5ee0942af68ec87eeba0c5, type: 2}
|
||||
--- !u!1 &1740340057
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2281,7 +2237,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 1fc36d0808cf971459d9e430faaeadd9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
MaxSpawned: 2000
|
||||
MaxSpawned: 250
|
||||
MinSpawnTime: 0
|
||||
MaxSpawnTime: 0.2
|
||||
FruitSpawnParent: {fileID: 1944344878}
|
||||
@@ -2932,6 +2888,74 @@ MonoBehaviour:
|
||||
MenuItemPrefab: {fileID: 1541142508120997748, guid: 74aff4063df1fab4c954bebfad022ff5,
|
||||
type: 3}
|
||||
BuildingPrefabs: {fileID: 11400000, guid: e6ae3d283005f994da00a3d8835a3cb5, type: 2}
|
||||
--- !u!1001 &2856219408887410068
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 3666462050572962762, guid: ab033116269e1b04a803e8de46580851,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3666462050572962762, guid: ab033116269e1b04a803e8de46580851,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3666462050572962762, guid: ab033116269e1b04a803e8de46580851,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3666462050572962762, guid: ab033116269e1b04a803e8de46580851,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3666462050572962762, guid: ab033116269e1b04a803e8de46580851,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3666462050572962762, guid: ab033116269e1b04a803e8de46580851,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3666462050572962762, guid: ab033116269e1b04a803e8de46580851,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3666462050572962762, guid: ab033116269e1b04a803e8de46580851,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3666462050572962762, guid: ab033116269e1b04a803e8de46580851,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3666462050572962762, guid: ab033116269e1b04a803e8de46580851,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4528292146240613971, guid: ab033116269e1b04a803e8de46580851,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: ItemRegistry
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: ab033116269e1b04a803e8de46580851, type: 3}
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2942,4 +2966,4 @@ SceneRoots:
|
||||
- {fileID: 1165634414}
|
||||
- {fileID: 525386540}
|
||||
- {fileID: 1935863238}
|
||||
- {fileID: 1618062728}
|
||||
- {fileID: 2856219408887410068}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,7 @@ namespace Fruitomation.Game
|
||||
{
|
||||
public string Name;
|
||||
public BuildingUnlock Requirement;
|
||||
public AutomationBuildingType Type;
|
||||
public GameObject Prefab;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using Unity.Plastic.Antlr3.Runtime.Tree;
|
||||
|
||||
namespace Fruitomation.Game.Items
|
||||
{
|
||||
|
||||
@@ -75,6 +75,19 @@ namespace Fruitomation.Game
|
||||
[Preserve] Peeler,
|
||||
}
|
||||
|
||||
[Serializable] public enum AutomationBuildingType
|
||||
{
|
||||
[Preserve] None,
|
||||
[Preserve] Slicer,
|
||||
[Preserve] Presser,
|
||||
[Preserve] HeatExchanger,
|
||||
[Preserve] Grinder,
|
||||
[Preserve] Mixer,
|
||||
[Preserve] Fermenter,
|
||||
[Preserve] Peeler,
|
||||
[Preserve] Spawner
|
||||
}
|
||||
|
||||
public class UnlockedUpgrades
|
||||
{
|
||||
[Serializable] public class Serialized
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using PashaBibko.Pacore.Attributes;
|
||||
using Fruitomation.Game;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fruitomation.Global
|
||||
@@ -9,14 +8,26 @@ namespace Fruitomation.Global
|
||||
private static MoneyController Instance;
|
||||
|
||||
[SerializeField, InspectorReadOnly("Current Money")]
|
||||
private double InternalCurrentMoney = new();
|
||||
public static double Current => Instance.InternalCurrentMoney;
|
||||
private double InternalCurrentMoney;
|
||||
public static double CurrentAmount => Instance.InternalCurrentMoney;
|
||||
|
||||
public static void ResetCurrentMoney()
|
||||
{
|
||||
Instance.InternalCurrentMoney = 0f;
|
||||
PlayerInfo.Data.CurrentMoney = 0f;
|
||||
}
|
||||
|
||||
public static void Add(double amount)
|
||||
{
|
||||
Instance.InternalCurrentMoney += amount;
|
||||
}
|
||||
|
||||
public static bool CouldBuy(double amount)
|
||||
{
|
||||
double val = Instance.InternalCurrentMoney - amount;
|
||||
return val > 0f;
|
||||
}
|
||||
|
||||
public static bool CanBuy(double amount)
|
||||
{
|
||||
double val = Instance.InternalCurrentMoney - amount;
|
||||
@@ -39,5 +50,10 @@ namespace Fruitomation.Global
|
||||
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
InternalCurrentMoney = PlayerInfo.Data.CurrentMoney;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
52
Assets/Scripts/Global/PlayerInfo.cs
Normal file
52
Assets/Scripts/Global/PlayerInfo.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using PashaBibko.Pacore.Attributes;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
namespace Fruitomation.Global
|
||||
{
|
||||
[Serializable] public class PlayerInfoData
|
||||
{
|
||||
public bool CompletedTutorial;
|
||||
public double CurrentMoney;
|
||||
}
|
||||
|
||||
[CreateInstanceOnStart] public class PlayerInfo : MonoBehaviour
|
||||
{
|
||||
private static string Filepath => Path.Combine(Application.persistentDataPath, "playerinfo.json");
|
||||
public static PlayerInfoData Data { get; private set; }
|
||||
|
||||
private static PlayerInfoData CreateDefaultPlayerData()
|
||||
{
|
||||
PlayerInfoData data = new()
|
||||
{
|
||||
CompletedTutorial = false,
|
||||
CurrentMoney = 0d
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (!File.Exists(Filepath))
|
||||
{
|
||||
Data = CreateDefaultPlayerData();
|
||||
return;
|
||||
}
|
||||
|
||||
string json = File.ReadAllText(Filepath);
|
||||
Data = json == ""
|
||||
? CreateDefaultPlayerData()
|
||||
: JsonUtility.FromJson<PlayerInfoData>(json);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Data.CurrentMoney = MoneyController.CurrentAmount;
|
||||
|
||||
string json = JsonUtility.ToJson(Data, true);
|
||||
File.WriteAllText(Filepath, json);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Global/PlayerInfo.cs.meta
Normal file
2
Assets/Scripts/Global/PlayerInfo.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8846c38a3d06a3249ad538d59638d5a5
|
||||
@@ -9,6 +9,6 @@ namespace Fruitomation.UI
|
||||
[SerializeField] private Text MoneyText;
|
||||
|
||||
private void Update() =>
|
||||
MoneyText.text = $"Current Money: {MoneyController.Current:F1}";
|
||||
MoneyText.text = $"Current Money: {MoneyController.CurrentAmount:F1}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using UnityEngine.UI;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using Fruitomation.Game.Items;
|
||||
using Fruitomation.Global;
|
||||
using PashaBibko.Pacore.Attributes;
|
||||
|
||||
@@ -31,11 +32,16 @@ namespace Fruitomation.UI
|
||||
[SerializeField] private double Cost;
|
||||
[SerializeField] private bool BigText;
|
||||
|
||||
[Header("Unlock Info\n")]
|
||||
[SerializeField] private ItemType[] Inputs;
|
||||
[SerializeField] private ItemType[] Outputs;
|
||||
[SerializeField] private AutomationBuildingType Building;
|
||||
|
||||
[Header("References")]
|
||||
[SerializeField] private UpgradeInfoBoard UpgradeBoard;
|
||||
[SerializeField] private BasicUpgradeButton[] RequiredUpgrades;
|
||||
[SerializeField] private Material LineMaterial;
|
||||
|
||||
[Header("Lines")]
|
||||
[SerializeField] private LineInfo[] Lines;
|
||||
|
||||
private (LineRenderer, BasicUpgradeButton, LineInfo)[] UpgradeLines;
|
||||
@@ -100,20 +106,15 @@ namespace Fruitomation.UI
|
||||
UpgradeLines = lines.ToArray();
|
||||
}
|
||||
|
||||
private void OnButtonClicked()
|
||||
{
|
||||
if (Cost == 0f)
|
||||
{
|
||||
Debug.LogWarning("Upgrade Cost has not been set");
|
||||
return;
|
||||
}
|
||||
|
||||
if (MoneyController.CanBuy(Cost))
|
||||
{
|
||||
UpgradeManager.Unlock(Upgrade);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnButtonClicked() => UpgradeBoard.Enable
|
||||
(
|
||||
Upgrade,
|
||||
Inputs,
|
||||
Outputs,
|
||||
Building,
|
||||
Cost
|
||||
);
|
||||
|
||||
private bool IsUnlockable =>
|
||||
RequiredUpgrades.Length == 0 ||
|
||||
RequiredUpgrades.All(required => required.IsUnlocked);
|
||||
@@ -164,7 +165,8 @@ namespace Fruitomation.UI
|
||||
State = UpgradeState.Hidden;
|
||||
}
|
||||
|
||||
AttachedButton.interactable = State == UpgradeState.Unlockable;
|
||||
AttachedButton.interactable =
|
||||
State is UpgradeState.Unlockable or UpgradeState.Unlocked;
|
||||
|
||||
string cost = Cost == 0f ? "UNAVAILABLE" : $"{Cost:F1}";
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.IO;
|
||||
using Fruitomation.Game;
|
||||
using Fruitomation.Global;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -21,7 +22,11 @@ namespace Fruitomation.UI
|
||||
ResetButton.onClick.AddListener(() =>
|
||||
{
|
||||
File.WriteAllText(BuildingManager.Filepath, "");
|
||||
|
||||
UpgradeManager.ResetUpgrades();
|
||||
MoneyController.ResetCurrentMoney();
|
||||
|
||||
SceneController.StartLoadOf("GameScene");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
151
Assets/Scripts/UI/UpgradeInfoBoard.cs
Normal file
151
Assets/Scripts/UI/UpgradeInfoBoard.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Fruitomation.Game.Items;
|
||||
using Fruitomation.Game;
|
||||
using Fruitomation.Global;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fruitomation.UI
|
||||
{
|
||||
public class UpgradeInfoBoard : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject BoardGO;
|
||||
[SerializeField] private Button[] ExitButtons;
|
||||
[SerializeField] private BuildingRegistry Registry;
|
||||
[SerializeField] private GameObject InputParent;
|
||||
[SerializeField] private GameObject OutputParent;
|
||||
[SerializeField] private GameObject BuildingDisplay;
|
||||
[SerializeField] private GameObject LeftArrow;
|
||||
[SerializeField] private GameObject SpawnerText;
|
||||
[SerializeField] private Button UnlockButton;
|
||||
[SerializeField] private GameObject UnlockedText;
|
||||
[SerializeField] private GameObject PoorPeopleText;
|
||||
|
||||
private readonly Dictionary<AutomationBuildingType, GameObject> BuildingRegistry = new();
|
||||
private readonly List<GameObject> ChildrenToKill = new();
|
||||
|
||||
private BasicUpgrade CurrentUpgrade;
|
||||
private double CurrentCost;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
BoardGO.SetActive(false);
|
||||
foreach (Button b in ExitButtons)
|
||||
{
|
||||
b.onClick.AddListener(Disable);
|
||||
}
|
||||
|
||||
foreach (BuildingRegistry.BuildingInfo info in Registry.GetBuildings())
|
||||
{
|
||||
if (info.Type != AutomationBuildingType.None)
|
||||
{
|
||||
BuildingRegistry.Add(info.Type, info.Prefab);
|
||||
}
|
||||
}
|
||||
|
||||
UnlockButton.onClick.AddListener(() =>
|
||||
{
|
||||
MoneyController.CanBuy(CurrentCost);
|
||||
UpgradeManager.Unlock(CurrentUpgrade);
|
||||
});
|
||||
}
|
||||
|
||||
public void Enable
|
||||
(
|
||||
BasicUpgrade upgrade,
|
||||
ItemType[] inputs,
|
||||
ItemType[] outputs,
|
||||
AutomationBuildingType building,
|
||||
double cost
|
||||
)
|
||||
// Wow, those function params are horrible
|
||||
{
|
||||
CurrentUpgrade = upgrade;
|
||||
CurrentCost = cost;
|
||||
|
||||
BoardGO.SetActive(true);
|
||||
|
||||
foreach (ItemType input in inputs)
|
||||
{
|
||||
ItemInfo info = ItemInfoRegistry.Get(input);
|
||||
GameObject go = Instantiate(info.Prefab, InputParent.transform);
|
||||
ChildrenToKill.Add(go);
|
||||
}
|
||||
|
||||
foreach (ItemType output in outputs)
|
||||
{
|
||||
ItemInfo info = ItemInfoRegistry.Get(output);
|
||||
GameObject go = Instantiate(info.Prefab, OutputParent.transform);
|
||||
ChildrenToKill.Add(go);
|
||||
}
|
||||
|
||||
if (building != AutomationBuildingType.Spawner)
|
||||
{
|
||||
BuildingDisplay.SetActive(true);
|
||||
LeftArrow.SetActive(true);
|
||||
SpawnerText.SetActive(false);
|
||||
|
||||
Sprite sprite = BuildingRegistry[building].GetComponent<Building>().Sprite;
|
||||
BuildingDisplay.GetComponent<Image>().sprite = sprite;
|
||||
|
||||
if (building == AutomationBuildingType.HeatExchanger)
|
||||
{
|
||||
RectTransform rt = BuildingDisplay.GetComponent<RectTransform>();
|
||||
rt.sizeDelta = new Vector2(125f, 250f);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
RectTransform rt = BuildingDisplay.GetComponent<RectTransform>();
|
||||
rt.sizeDelta = new Vector2(250f, 250f);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
BuildingDisplay.SetActive(false);
|
||||
LeftArrow.SetActive(false);
|
||||
SpawnerText.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (UpgradeManager.Is(CurrentUpgrade))
|
||||
{
|
||||
UnlockedText.SetActive(true);
|
||||
|
||||
UnlockButton.gameObject.SetActive(false);
|
||||
PoorPeopleText.SetActive(false);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
UnlockedText.SetActive(false);
|
||||
|
||||
if (MoneyController.CouldBuy(CurrentCost))
|
||||
{
|
||||
UnlockButton.gameObject.SetActive(true);
|
||||
PoorPeopleText.SetActive(false);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
UnlockButton.gameObject.SetActive(false);
|
||||
PoorPeopleText.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Disable()
|
||||
{
|
||||
BoardGO.SetActive(false);
|
||||
foreach (GameObject child in ChildrenToKill)
|
||||
{
|
||||
Destroy(child);
|
||||
}
|
||||
ChildrenToKill.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/UpgradeInfoBoard.cs.meta
Normal file
3
Assets/Scripts/UI/UpgradeInfoBoard.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4c6a04234de4d38a0c2efa098d3aed3
|
||||
timeCreated: 1777970079
|
||||
@@ -529,6 +529,9 @@ PlayerSettings:
|
||||
- m_BuildTarget: Standalone
|
||||
m_StaticBatching: 1
|
||||
m_DynamicBatching: 0
|
||||
- m_BuildTarget: WebGL
|
||||
m_StaticBatching: 0
|
||||
m_DynamicBatching: 0
|
||||
m_BuildTargetShaderSettings: []
|
||||
m_BuildTargetGraphicsJobs: []
|
||||
m_BuildTargetGraphicsJobMode: []
|
||||
@@ -838,10 +841,8 @@ PlayerSettings:
|
||||
scriptingDefineSymbols: {}
|
||||
additionalCompilerArguments: {}
|
||||
platformArchitecture: {}
|
||||
scriptingBackend:
|
||||
Standalone: 0
|
||||
il2cppCompilerConfiguration:
|
||||
Standalone: 1
|
||||
scriptingBackend: {}
|
||||
il2cppCompilerConfiguration: {}
|
||||
il2cppCodeGeneration: {}
|
||||
il2cppStacktraceInformation: {}
|
||||
managedStrippingLevel:
|
||||
|
||||
Reference in New Issue
Block a user