Skip to content

Commit

Permalink
Fix victory screen trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
harperbolic committed Oct 13, 2023
1 parent 5cbc2ad commit ffe35d4
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 15 deletions.
18 changes: 17 additions & 1 deletion unity/Assets/Levels/Level_1_1.asset
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,20 @@ MonoBehaviour:
- spawnPoints:
- position: 3
spawnEntity: {fileID: 2537977478247289798, guid: 0d67a95c7b01abc41a4821429bd4b49f, type: 3}
secondsToNextRow: 2
secondsToNextRow: 3
- spawnPoints:
- position: 6
spawnEntity: {fileID: 2537977478247289798, guid: 0d67a95c7b01abc41a4821429bd4b49f, type: 3}
secondsToNextRow: 3
- spawnPoints:
- position: 6
spawnEntity: {fileID: 827757396236092952, guid: 77dc834b6959a1b4d8e77321ea4b364c, type: 3}
secondsToNextRow: 3
- spawnPoints:
- position: 0
spawnEntity: {fileID: 827757396236092952, guid: 77dc834b6959a1b4d8e77321ea4b364c, type: 3}
secondsToNextRow: 3
- spawnPoints:
- position: 0
spawnEntity: {fileID: 2537977478247289798, guid: 0d67a95c7b01abc41a4821429bd4b49f, type: 3}
secondsToNextRow: 5
46 changes: 46 additions & 0 deletions unity/Assets/Prefabs/EndStage.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1662983896151453446
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7110501085579380524}
- component: {fileID: 6750304806103565804}
m_Layer: 0
m_Name: EndStage
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7110501085579380524
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1662983896151453446}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -26.922993, y: -69.99259, z: 151.087}
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 &6750304806103565804
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1662983896151453446}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6bbeeff3104eb1844901d942471a545c, type: 3}
m_Name:
m_EditorClassIdentifier:
7 changes: 7 additions & 0 deletions unity/Assets/Prefabs/EndStage.prefab.meta

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

60 changes: 59 additions & 1 deletion unity/Assets/Scenes/Level_0.unity
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5c0d6bf0efa24374c8f7449065938ea4, type: 3}
m_Name:
m_EditorClassIdentifier:
hp: 1
hp: 3
bulletSpeed: 0.9
velocidadeMovimento: 10
limiteEsquerdo: -4
Expand Down Expand Up @@ -1405,6 +1405,63 @@ Transform:
m_Children: []
m_Father: {fileID: 485968588}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1469495129
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1662983896151453446, guid: 4f15508b207943b49aa16419f068468d, type: 3}
propertyPath: m_Name
value: EndStage
objectReference: {fileID: 0}
- target: {fileID: 7110501085579380524, guid: 4f15508b207943b49aa16419f068468d, type: 3}
propertyPath: m_LocalPosition.x
value: -26.922993
objectReference: {fileID: 0}
- target: {fileID: 7110501085579380524, guid: 4f15508b207943b49aa16419f068468d, type: 3}
propertyPath: m_LocalPosition.y
value: -69.99259
objectReference: {fileID: 0}
- target: {fileID: 7110501085579380524, guid: 4f15508b207943b49aa16419f068468d, type: 3}
propertyPath: m_LocalPosition.z
value: 151.087
objectReference: {fileID: 0}
- target: {fileID: 7110501085579380524, guid: 4f15508b207943b49aa16419f068468d, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7110501085579380524, guid: 4f15508b207943b49aa16419f068468d, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7110501085579380524, guid: 4f15508b207943b49aa16419f068468d, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7110501085579380524, guid: 4f15508b207943b49aa16419f068468d, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7110501085579380524, guid: 4f15508b207943b49aa16419f068468d, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7110501085579380524, guid: 4f15508b207943b49aa16419f068468d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7110501085579380524, guid: 4f15508b207943b49aa16419f068468d, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4f15508b207943b49aa16419f068468d, type: 3}
--- !u!1 &1474365686
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2122,3 +2179,4 @@ SceneRoots:
- {fileID: 74334557}
- {fileID: 2126177575}
- {fileID: 1771182260}
- {fileID: 1469495129}
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions unity/Assets/Scripts/EndStage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class EndStage : MonoBehaviour
{
void Start()
{
StartCoroutine(waiter());
}

IEnumerator waiter()
{
yield return new WaitForSeconds(18);
SceneManager.LoadScene("Victory");
}
}
11 changes: 11 additions & 0 deletions unity/Assets/Scripts/EndStage.cs.meta

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

15 changes: 2 additions & 13 deletions unity/Assets/Scripts/levelSpawner.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class levelSpawner : MonoBehaviour
{
[SerializeField]
private float secondsToStart;
[SerializeField]
private Level level;
[SerializeField] private Level level;
private int nextRow;
[SerializeField] private GameObject[] spawnPoints;
private void Start()
Expand All @@ -23,21 +21,12 @@ private IEnumerator Spawn(float timeToWait, Row rowToSpawn)
{
Instantiate(toSpawn.spawnEntity, spawnPoints[toSpawn.position].transform);
}
if (level.rows.Length >= nextRow + 1)
{
//StartSpawn();
SceneManager.LoadScene("Victory");

}
else
{
yield return Spawn(level.rows[nextRow].secondsToNextRow, level.rows[++nextRow]);
}
}
private void StartSpawn()
{
//Logar quantos segundos dura a seção da fase (útil para evitar manter a fase curta ou longa demais)
float levelLength = 60;
float levelLength = 20;
foreach (var row in level.rows)
{
levelLength += row.secondsToNextRow;
Expand Down
3 changes: 3 additions & 0 deletions unity/ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/GameOverScreen.unity
guid: 2535e62eb5a4aee44abcb28fbd8eeda7
- enabled: 1
path: Assets/Scenes/Victory.unity
guid: 4f0c6e36514eac74d92bac0ddbb4db47
m_configObjects: {}

0 comments on commit ffe35d4

Please sign in to comment.