Add lose condition.

This commit is contained in:
Kaj Forney 2021-10-21 13:18:47 -06:00
parent 0248c5fb8c
commit 6998a09f19
Signed by: kforney
GPG key ID: 3AB4E2E04CEF656F
7 changed files with 1491 additions and 93 deletions

View file

@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 6236062734293464139}
- component: {fileID: 376557520294348530}
- component: {fileID: 6834817323510214274}
- component: {fileID: 1115786833419870455}
m_Layer: 3
m_Name: tetrominoBase
m_TagString: Tetromino
@ -110,3 +111,99 @@ BoxCollider2D:
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!82 &1115786833419870455
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6737607240575143600}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 75fdc3024561a4a9fb5c4698d3e811a0, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

View file

@ -737,7 +737,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 12
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &629091407
GameObject:
@ -844,7 +844,7 @@ Transform:
m_LocalScale: {x: 3, y: 2, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -90}
--- !u!114 &629091411
MonoBehaviour:
@ -1666,8 +1666,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -288.29663, y: 176.46997}
m_SizeDelta: {x: 98.0067, y: 44.909}
m_AnchoredPosition: {x: -278.3, y: 164.36984}
m_SizeDelta: {x: 98.0067, y: 53.7725}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1386772421
MonoBehaviour:
@ -1755,7 +1755,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1451940424
MonoBehaviour:
@ -2084,7 +2084,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1618236901
GameObject:
@ -2238,8 +2238,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -339.06018, y: 127.048}
m_SizeDelta: {x: 121.8797, y: 67.904}
m_AnchoredPosition: {x: -329.06354, y: 114.55691}
m_SizeDelta: {x: 121.8797, y: 75.1463}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1841208826
MonoBehaviour:
@ -2335,88 +2335,5 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2113729827
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2113729829}
- component: {fileID: 2113729828}
m_Layer: 0
m_Name: backgroundStatic
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!212 &2113729828
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2113729827}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: b77f39928043c4f4d9d79b8597c9810f, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 100, y: 75}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &2113729829
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2113729827}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.5, z: 500}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3c0fd43aab8b69009924c1d2a9f0ce09
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
public class tetromino : MonoBehaviour
{
@ -77,6 +78,11 @@ public class tetromino : MonoBehaviour
ScoreCounter.scoreAmount += 100;
return true;
}
//We do also want to check if we're crushing the player.
if (collision.collider.CompareTag("Player"))
{
SceneManager.LoadScene("loseScreen");
}
}
return false;
@ -86,4 +92,5 @@ public class tetromino : MonoBehaviour
{
transform.position += Vector3.down * 1.0f;
}
}

View file

@ -72,7 +72,6 @@ public class tetrominoUserControl : MonoBehaviour
foreach (Transform child in activeTetromino.transform)
{
RaycastHit2D collision = Physics2D.Raycast(child.position, direction, 1.0f);
// Debug.DrawRay(pieceToCheck.position,Vector3.down,Color.red,1000.0f);
if (collision.collider != null && collision.collider.transform.parent != child.parent)
{
wouldCollide = true;

View file

@ -14,4 +14,7 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/winScreen.unity
guid: 36b5492f71beae7f09ea54dd80d8c5b9
- enabled: 1
path: Assets/Scenes/loseScreen.unity
guid: 3c0fd43aab8b69009924c1d2a9f0ce09
m_configObjects: {}