Skip to content
Snippets Groups Projects
Commit 65813a7b authored by Erno Lokkila's avatar Erno Lokkila
Browse files

win button hidden until enough money

parent 35ff363c
Branches
No related tags found
No related merge requests found
...@@ -71,7 +71,7 @@ SpriteRenderer: ...@@ -71,7 +71,7 @@ SpriteRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: a69243cd6bee5c34497418b7bbea1e20, type: 3} m_Sprite: {fileID: 21300000, guid: 4ffb6badf0a2c454c990a42fe64e9d03, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
...@@ -99,7 +99,7 @@ BoxCollider2D: ...@@ -99,7 +99,7 @@ BoxCollider2D:
m_SpriteTilingProperty: m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5} pivot: {x: 0.5, y: 0.5}
oldSize: {x: 1.28, y: 1.28} oldSize: {x: 1, y: 1}
newSize: {x: 1.28, y: 1.28} newSize: {x: 1.28, y: 1.28}
adaptiveTilingThreshold: 0.5 adaptiveTilingThreshold: 0.5
drawMode: 0 drawMode: 0
...@@ -120,6 +120,12 @@ MonoBehaviour: ...@@ -120,6 +120,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f67208887d2c19940b9afdc55a275b38, type: 3} m_Script: {fileID: 11500000, guid: f67208887d2c19940b9afdc55a275b38, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
sprites:
- {fileID: 21300000, guid: 4ffb6badf0a2c454c990a42fe64e9d03, type: 3}
- {fileID: 21300002, guid: 4ffb6badf0a2c454c990a42fe64e9d03, type: 3}
- {fileID: 21300004, guid: 4ffb6badf0a2c454c990a42fe64e9d03, type: 3}
- {fileID: 21300006, guid: 4ffb6badf0a2c454c990a42fe64e9d03, type: 3}
- {fileID: 21300008, guid: 4ffb6badf0a2c454c990a42fe64e9d03, type: 3}
respanelPrefab: {fileID: 3345454733487414898, guid: 588b79ebfef5a2c4887615dc4856cc0c, respanelPrefab: {fileID: 3345454733487414898, guid: 588b79ebfef5a2c4887615dc4856cc0c,
type: 3} type: 3}
resrowPrefab: {fileID: 5085001290068357248, guid: 72232997f27e3c2448b5ad647af22a35, resrowPrefab: {fileID: 5085001290068357248, guid: 72232997f27e3c2448b5ad647af22a35,
......
...@@ -5,6 +5,10 @@ using UnityEngine; ...@@ -5,6 +5,10 @@ using UnityEngine;
public class City : MonoBehaviour public class City : MonoBehaviour
{ {
[SerializeField]
Sprite[] sprites;
private int spriteIndex = 0;
[SerializeField] [SerializeField]
GameObject respanelPrefab; GameObject respanelPrefab;
...@@ -104,7 +108,9 @@ public class City : MonoBehaviour ...@@ -104,7 +108,9 @@ public class City : MonoBehaviour
public void AddPopulation(int v) public void AddPopulation(int v)
{ {
spriteIndex = Math.Min(spriteIndex+1, sprites.Length-1);
this.population += v; this.population += v;
gameObject.GetComponent<SpriteRenderer>().sprite = sprites[spriteIndex];
} }
private void Update() private void Update()
...@@ -179,7 +185,6 @@ public class City : MonoBehaviour ...@@ -179,7 +185,6 @@ public class City : MonoBehaviour
resurssit.RemoveAt(k); resurssit.RemoveAt(k);
} }
Debug.Log(poolit[j].GetAmount());
if (poolit[j].GetAmount() < amount) if (poolit[j].GetAmount() < amount)
{ {
return false; return false;
...@@ -187,7 +192,6 @@ public class City : MonoBehaviour ...@@ -187,7 +192,6 @@ public class City : MonoBehaviour
} }
} }
} }
Debug.Log(resurssit.Count);
return resurssit.Count == 0; return resurssit.Count == 0;
} }
/** /**
......
...@@ -11,7 +11,11 @@ public class BuyCity : MonoBehaviour ...@@ -11,7 +11,11 @@ public class BuyCity : MonoBehaviour
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
if(!transform.root.gameObject.GetComponent<City>().IsSufficientResources(createResourceGO(), 150))
{
Color c = gameObject.GetComponent<SpriteRenderer>().color;
gameObject.GetComponent<SpriteRenderer>().color = c - new Color(25, 25, 25);
}
} }
// Update is called once per frame // Update is called once per frame
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment