economy shit
This commit is contained in:
parent
318e534531
commit
f632ee471a
File diff suppressed because one or more lines are too long
|
@ -34,7 +34,7 @@ RectTransform:
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 1}
|
m_AnchorMin: {x: 0.5, y: 1}
|
||||||
m_AnchorMax: {x: 0.5, y: 1}
|
m_AnchorMax: {x: 0.5, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: -6.8}
|
m_AnchoredPosition: {x: 0, y: -6.800003}
|
||||||
m_SizeDelta: {x: 115.1155, y: 25.5046}
|
m_SizeDelta: {x: 115.1155, y: 25.5046}
|
||||||
m_Pivot: {x: 0.5, y: 1}
|
m_Pivot: {x: 0.5, y: 1}
|
||||||
--- !u!222 &7689507736539613673
|
--- !u!222 &7689507736539613673
|
||||||
|
@ -636,7 +636,7 @@ Canvas:
|
||||||
m_GameObject: {fileID: 715023913428069073}
|
m_GameObject: {fileID: 715023913428069073}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_RenderMode: 0
|
m_RenderMode: 1
|
||||||
m_Camera: {fileID: 0}
|
m_Camera: {fileID: 0}
|
||||||
m_PlaneDistance: 100
|
m_PlaneDistance: 100
|
||||||
m_PixelPerfect: 0
|
m_PixelPerfect: 0
|
||||||
|
@ -647,7 +647,7 @@ Canvas:
|
||||||
m_VertexColorAlwaysGammaSpace: 0
|
m_VertexColorAlwaysGammaSpace: 0
|
||||||
m_AdditionalShaderChannelsFlag: 25
|
m_AdditionalShaderChannelsFlag: 25
|
||||||
m_UpdateRectTransformForStandalone: 0
|
m_UpdateRectTransformForStandalone: 0
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: -767687967
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
m_TargetDisplay: 0
|
m_TargetDisplay: 0
|
||||||
--- !u!114 &4835633829532637798
|
--- !u!114 &4835633829532637798
|
||||||
|
@ -1304,6 +1304,7 @@ GameObject:
|
||||||
- component: {fileID: 8910208410353961356}
|
- component: {fileID: 8910208410353961356}
|
||||||
- component: {fileID: 5247536788810898341}
|
- component: {fileID: 5247536788810898341}
|
||||||
- component: {fileID: 7089564642283241555}
|
- component: {fileID: 7089564642283241555}
|
||||||
|
- component: {fileID: 5392333961791742706}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: Scrap Text
|
m_Name: Scrap Text
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -1428,6 +1429,19 @@ MonoBehaviour:
|
||||||
m_hasFontAssetChanged: 0
|
m_hasFontAssetChanged: 0
|
||||||
m_baseMaterial: {fileID: 0}
|
m_baseMaterial: {fileID: 0}
|
||||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
--- !u!114 &5392333961791742706
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2234419455049360093}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 7baabee564ffd2775907492ea319584e, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
text: {fileID: 7089564642283241555}
|
||||||
--- !u!1 &2480620014458753815
|
--- !u!1 &2480620014458753815
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -2855,7 +2869,7 @@ RectTransform:
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 1, y: 0.5}
|
m_AnchorMin: {x: 1, y: 0.5}
|
||||||
m_AnchorMax: {x: 1, y: 0.5}
|
m_AnchorMax: {x: 1, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 359.99994, y: 0}
|
m_AnchoredPosition: {x: 360, y: 0}
|
||||||
m_SizeDelta: {x: 720, y: 1100}
|
m_SizeDelta: {x: 720, y: 1100}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &8199987074529867173
|
--- !u!222 &8199987074529867173
|
||||||
|
@ -3304,7 +3318,7 @@ RectTransform:
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 46.2, y: 47.9}
|
m_AnchoredPosition: {x: 46.19995, y: 47.900024}
|
||||||
m_SizeDelta: {x: 100, y: 150}
|
m_SizeDelta: {x: 100, y: 150}
|
||||||
m_Pivot: {x: 0, y: 0}
|
m_Pivot: {x: 0, y: 0}
|
||||||
--- !u!222 &63844667557183575
|
--- !u!222 &63844667557183575
|
||||||
|
@ -4651,6 +4665,11 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8630885327163994142, guid: fff998a9abaaf2f43a388f7a721aa1c2,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: -20.599998
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
|
@ -4786,6 +4805,11 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8630885327163994142, guid: fff998a9abaaf2f43a388f7a721aa1c2,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: -20.599998
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
|
@ -4921,6 +4945,11 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8630885327163994142, guid: fff998a9abaaf2f43a388f7a721aa1c2,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: -20.599998
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
|
@ -5056,6 +5085,11 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8630885327163994142, guid: fff998a9abaaf2f43a388f7a721aa1c2,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: -20.599998
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
|
@ -5191,6 +5225,11 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8630885327163994142, guid: fff998a9abaaf2f43a388f7a721aa1c2,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: -20.599998
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
|
|
|
@ -3,7 +3,7 @@ using UnityEngine;
|
||||||
|
|
||||||
public class GameManager : MonoBehaviour
|
public class GameManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
public float Balance = 0;
|
public Observer<float> Balance = new(500f);
|
||||||
public static GameManager Instance;
|
public static GameManager Instance;
|
||||||
|
|
||||||
public bool IsBuildMode = false;
|
public bool IsBuildMode = false;
|
||||||
|
|
|
@ -40,7 +40,11 @@ public class MoneyManager : MonoBehaviour
|
||||||
private void OnShopButtonClicked(int index)
|
private void OnShopButtonClicked(int index)
|
||||||
{
|
{
|
||||||
Assert.AreNotEqual(index, -1, "Shop button not init-ed with index");
|
Assert.AreNotEqual(index, -1, "Shop button not init-ed with index");
|
||||||
|
TowerInfo info = towerCollection.Towers[index];
|
||||||
|
|
||||||
OnShopSelected?.Invoke(towerCollection.Towers[index]);
|
if (GameManager.Instance.Balance >= info.price)
|
||||||
|
{
|
||||||
|
OnShopSelected?.Invoke(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,10 +88,14 @@ public class TowerPlacementManager : MonoBehaviour
|
||||||
|
|
||||||
public void OnSlotClicked(SlotManager slot, GridManager grid, int x, int y)
|
public void OnSlotClicked(SlotManager slot, GridManager grid, int x, int y)
|
||||||
{
|
{
|
||||||
slot.gameObject.GetComponentInChildren<Renderer>().material.color = Color.blue;
|
if (GameManager.Instance.Balance.Value < SelectedTowerInfo.price) return; // cant afford
|
||||||
|
|
||||||
|
// slot.gameObject.GetComponentInChildren<Renderer>().material.color = Color.blue;
|
||||||
OnSelectSlot(slot);
|
OnSelectSlot(slot);
|
||||||
|
|
||||||
SpawnTowerAtSelected(SelectedTowerPrefab);
|
SpawnTowerAtSelected(SelectedTowerPrefab);
|
||||||
|
Debug.Log("TAX");
|
||||||
|
GameManager.Instance.Balance.Value -= SelectedTowerInfo.price;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when a slot is selected
|
// Called when a slot is selected
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
public class BalanceDisplay : MonoBehaviour
|
||||||
|
{
|
||||||
|
public TMP_Text text;
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
// idgaf
|
||||||
|
UpdateText(GameManager.Instance.Balance.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateText(float balance)
|
||||||
|
{
|
||||||
|
text.text = $"$ {balance}";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7baabee564ffd2775907492ea319584e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue