Skip to content

Commit

Permalink
Fixed no cooldown 'feature' and vine on same layer bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SiiMeR committed Jan 28, 2018
1 parent 99a6da0 commit 814b7ae
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Assets/Prefabs/Stem.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingLayerID: -7959831
m_SortingLayer: -1
m_SortingOrder: -1
m_Sprite: {fileID: 21300000, guid: cbba845091ec7564c86f405bf15f623a, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
Expand Down
16 changes: 8 additions & 8 deletions Assets/Scenes/MainMenu.unity
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ Prefab:
- target: {fileID: 224941336562339878, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
propertyPath: m_AnchoredPosition.x
value: 280
value: 370
objectReference: {fileID: 0}
- target: {fileID: 224941336562339878, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
propertyPath: m_AnchoredPosition.y
value: 157.5
value: 300.5
objectReference: {fileID: 0}
- target: {fileID: 224941336562339878, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
Expand Down Expand Up @@ -213,17 +213,17 @@ Prefab:
- target: {fileID: 224941336562339878, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
propertyPath: m_LocalScale.x
value: 0.7
value: 0.925
objectReference: {fileID: 0}
- target: {fileID: 224941336562339878, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
propertyPath: m_LocalScale.y
value: 0.7
value: 0.925
objectReference: {fileID: 0}
- target: {fileID: 224941336562339878, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
propertyPath: m_LocalScale.z
value: 0.7
value: 0.925
objectReference: {fileID: 0}
- target: {fileID: 224823645951736554, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
Expand All @@ -243,7 +243,7 @@ Prefab:
- target: {fileID: 224823645951736554, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
propertyPath: m_AnchoredPosition.y
value: 0
value: -47.4
objectReference: {fileID: 0}
- target: {fileID: 224823645951736554, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
Expand All @@ -268,7 +268,7 @@ Prefab:
- target: {fileID: 224463087255423964, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
propertyPath: m_AnchoredPosition.y
value: 0
value: -47.4
objectReference: {fileID: 0}
- target: {fileID: 224463087255423964, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
Expand All @@ -293,7 +293,7 @@ Prefab:
- target: {fileID: 224205663708990492, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
propertyPath: m_AnchoredPosition.y
value: 0
value: -47.4
objectReference: {fileID: 0}
- target: {fileID: 224205663708990492, guid: cdd21528fd10d3b41849b582b0bddf50,
type: 2}
Expand Down
10 changes: 5 additions & 5 deletions Assets/Scenes/Reimo.unity
Original file line number Diff line number Diff line change
Expand Up @@ -807,12 +807,12 @@ Prefab:
- target: {fileID: 224120339577557352, guid: b8fecf5c95e379e429097bc32af8e461,
type: 2}
propertyPath: m_AnchoredPosition.x
value: 280
value: 320
objectReference: {fileID: 0}
- target: {fileID: 224120339577557352, guid: b8fecf5c95e379e429097bc32af8e461,
type: 2}
propertyPath: m_AnchoredPosition.y
value: 157.5
value: 252.5
objectReference: {fileID: 0}
- target: {fileID: 224120339577557352, guid: b8fecf5c95e379e429097bc32af8e461,
type: 2}
Expand Down Expand Up @@ -862,17 +862,17 @@ Prefab:
- target: {fileID: 224120339577557352, guid: b8fecf5c95e379e429097bc32af8e461,
type: 2}
propertyPath: m_LocalScale.x
value: 0.7
value: 0.8
objectReference: {fileID: 0}
- target: {fileID: 224120339577557352, guid: b8fecf5c95e379e429097bc32af8e461,
type: 2}
propertyPath: m_LocalScale.y
value: 0.7
value: 0.8
objectReference: {fileID: 0}
- target: {fileID: 224120339577557352, guid: b8fecf5c95e379e429097bc32af8e461,
type: 2}
propertyPath: m_LocalScale.z
value: 0.7
value: 0.8
objectReference: {fileID: 0}
- target: {fileID: 224829397564694878, guid: b8fecf5c95e379e429097bc32af8e461,
type: 2}
Expand Down
36 changes: 30 additions & 6 deletions Assets/Scripts/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ public class Game : MonoBehaviour

public float speed = 1f;
private float FLOWER_COOLDOWN = 4.0f;
private float maxSpeed = 50f;
private float FLOWER_COOLDOWN_MIN = 1.0f;
private float maxSpeed = 70f;
private float speedIncrement = 0.5f;
private float speedChangeInterval = 10f;

private List<GameObject> layer1Flowers;
private List<GameObject> layer2Flowers;
private GameObject player;


private bool generatelayer1Vine = true;
private bool gameOn;

private bool layer1Active = true;
Expand Down Expand Up @@ -78,7 +79,21 @@ void manageLayer1()
{
timeSpentLayer1 = 0;
GameObject newFlower = generateNewFlower();


if (newFlower.name.Contains("Stem") && !generatelayer1Vine)
{
newFlower.GetComponent<SpriteRenderer>().sortingLayerName = "Layer_2";
if (layer1Active)
{
setAlphaAndCollision(newFlower,false);
}
else
{
setAlphaAndCollision(newFlower,true);
}
layer2Flowers.Add(newFlower);
return;
}
if (layer1Active)
{
setAlphaAndCollision(newFlower,true);
Expand Down Expand Up @@ -138,11 +153,15 @@ void manageLayer2()
timeSpentLayer2 = 0;
GameObject newFlower = generateNewFlower();
newFlower.transform.localScale = new Vector3(newFlower.transform.localScale.x-0.2f,newFlower.transform.localScale.y-0.2f,1f);

foreach (var sr in newFlower.GetComponentsInChildren<SpriteRenderer>())
{
sr.sortingLayerName = "Layer_2";
}
/* if (newFlower.GetComponent<SpriteRenderer>())
{
newFlower.GetComponent<SpriteRenderer>().sortingLayerName = "Layer_2";
}*/
if (layer1Active)
{
setAlphaAndCollision(newFlower,false);
Expand Down Expand Up @@ -184,7 +203,11 @@ void Update()
{
speed += speedIncrement;
timeSinceSpeedChange = 0f;
FLOWER_COOLDOWN -= 0.2f;
if (FLOWER_COOLDOWN > FLOWER_COOLDOWN_MIN)
{
FLOWER_COOLDOWN -= 0.2f;
}

}


Expand Down Expand Up @@ -244,6 +267,7 @@ GameObject generateNewFlower()
multiplier = 1f;
vineTime = 0f;
timeBetweenVines = Random.Range(10, 30);
generatelayer1Vine = !generatelayer1Vine;
}
}
else
Expand Down

0 comments on commit 814b7ae

Please sign in to comment.