From 143a46b6e962a2b582bcef0cd2d157dbacfc5c4e Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 27 Jun 2023 12:45:01 -0400 Subject: [PATCH] core gameplay working --- namedropper/Assets/CardDataDrawer.cs | 9 +- .../Assets/Prefabs/Category Prefab.prefab | 180 ++++++++- .../Assets/Prefabs/Player Prefab.prefab | 343 +++++++++++++++++- namedropper/Assets/Scripts/Category.cs | 41 ++- namedropper/Assets/Scripts/Game.cs | 2 +- namedropper/Assets/Scripts/Level.cs | 9 +- namedropper/Assets/Scripts/Player.cs | 41 ++- 7 files changed, 612 insertions(+), 13 deletions(-) diff --git a/namedropper/Assets/CardDataDrawer.cs b/namedropper/Assets/CardDataDrawer.cs index a15775d..8697ee5 100644 --- a/namedropper/Assets/CardDataDrawer.cs +++ b/namedropper/Assets/CardDataDrawer.cs @@ -6,15 +6,20 @@ using UnityEngine.UI; public class CardDataDrawer : MonoBehaviour { [SerializeField] GameObject[] _shapeSprites; - CardData _cardData; + public CardData _cardData; // Start is called before the first frame update void Start() + { + Randomize(); + } + + public void Randomize() { _cardData = new CardData(); _cardData.Randomize(); - for (int i=0;i< _shapeSprites.Length;i++) + for (int i = 0; i < _shapeSprites.Length; i++) { _shapeSprites[i].GetComponent().sprite = _cardData.GetSprite(); _shapeSprites[i].SetActive(i < _cardData._number); diff --git a/namedropper/Assets/Prefabs/Category Prefab.prefab b/namedropper/Assets/Prefabs/Category Prefab.prefab index c3cf4d2..e672fcc 100644 --- a/namedropper/Assets/Prefabs/Category Prefab.prefab +++ b/namedropper/Assets/Prefabs/Category Prefab.prefab @@ -117,6 +117,7 @@ Transform: - {fileID: 6747320240088940386} - {fileID: 3032088937872018548} - {fileID: 2462013288784083471} + - {fileID: 6768890663314167569} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -147,6 +148,7 @@ MonoBehaviour: _feedbackGood: {fileID: 4304540116731250660} _feedbackBad: {fileID: 3551932467328341787} _streak: {fileID: 1565607471538169626} + _shieldsText: {fileID: 3173673145629268070} --- !u!61 &1085594869219034861 BoxCollider2D: m_ObjectHideFlags: 0 @@ -762,6 +764,178 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &4628035785503037365 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6768890663314167569} + - component: {fileID: 7374123187186425720} + - component: {fileID: 3173673145629268070} + m_Layer: 0 + m_Name: Shields + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6768890663314167569 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4628035785503037365} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 188.9996} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1499098757095760799} + m_RootOrder: 10 + 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: -122.7, y: -481} + m_SizeDelta: {x: 500, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!23 &7374123187186425720 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4628035785503037365} + 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: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + 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: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!114 &3173673145629268070 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4628035785503037365} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 561 + m_fontSizeBase: 561 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 0 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + _SortingLayer: 0 + _SortingLayerID: 0 + _SortingOrder: 0 + m_hasFontAssetChanged: 0 + m_renderer: {fileID: 7374123187186425720} + m_maskType: 0 --- !u!1 &4698135363407727744 GameObject: m_ObjectHideFlags: 0 @@ -854,7 +1028,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &8816928777131923770 Transform: m_ObjectHideFlags: 0 @@ -877,7 +1051,7 @@ SpriteRenderer: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7182421569596414056} - m_Enabled: 1 + m_Enabled: 0 m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 1 @@ -938,7 +1112,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &124791215424900615 Transform: m_ObjectHideFlags: 0 diff --git a/namedropper/Assets/Prefabs/Player Prefab.prefab b/namedropper/Assets/Prefabs/Player Prefab.prefab index d6680ef..f702b1f 100644 --- a/namedropper/Assets/Prefabs/Player Prefab.prefab +++ b/namedropper/Assets/Prefabs/Player Prefab.prefab @@ -1,5 +1,157 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &482245573507682842 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 482762097022507376} + - component: {fileID: 4904156822027773180} + - component: {fileID: 7892523715604001625} + m_Layer: 0 + m_Name: ShapeTopLeft + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &482762097022507376 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 482245573507682842} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -188.99962} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9049015333349338420} + m_RootOrder: 4 + 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: -35.1, y: 29.9} + m_SizeDelta: {x: 63, y: 63} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4904156822027773180 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 482245573507682842} + m_CullTransparentMesh: 1 +--- !u!114 &7892523715604001625 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 482245573507682842} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 33c4632329ed20f4d91996fd8e3e429f, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1933936841026696079 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8558891503575618383} + - component: {fileID: 1335345286637122339} + - component: {fileID: 6532320728310998695} + m_Layer: 0 + m_Name: ShapeBottomRight + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8558891503575618383 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1933936841026696079} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -188.99962} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9049015333349338420} + m_RootOrder: 7 + 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: 29.900024, y: -32.099976} + m_SizeDelta: {x: 63, y: 63} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1335345286637122339 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1933936841026696079} + m_CullTransparentMesh: 1 +--- !u!114 &6532320728310998695 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1933936841026696079} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 33c4632329ed20f4d91996fd8e3e429f, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!1 &3223008826524451067 GameObject: m_ObjectHideFlags: 0 @@ -27,6 +179,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 33.67} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 9049015333349338420} m_RootOrder: 3 @@ -47,6 +200,7 @@ SpriteRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -114,6 +268,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: -0.16} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 9049015333349338420} m_RootOrder: 2 @@ -134,6 +289,7 @@ SpriteRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -201,6 +357,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: -5, y: -5, z: -0.16} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 9049015333349338420} m_RootOrder: 1 @@ -216,6 +373,7 @@ SpriteRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -274,7 +432,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &3246767593435583328 RectTransform: m_ObjectHideFlags: 0 @@ -285,6 +443,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: -0.039957315, w: 0.9992014} m_LocalPosition: {x: 0, y: 0, z: 122.6} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 9049015333349338420} m_RootOrder: 0 @@ -305,6 +464,7 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -432,6 +592,158 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &8283750470600269748 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4528333479651783988} + - component: {fileID: 7158204951566801307} + - component: {fileID: 5132225095039799502} + m_Layer: 0 + m_Name: ShapeTopRight + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4528333479651783988 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8283750470600269748} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -188.99962} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9049015333349338420} + m_RootOrder: 6 + 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: 29.900024, y: 29.900024} + m_SizeDelta: {x: 63, y: 63} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7158204951566801307 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8283750470600269748} + m_CullTransparentMesh: 1 +--- !u!114 &5132225095039799502 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8283750470600269748} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 33c4632329ed20f4d91996fd8e3e429f, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9032701300591666026 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7865774197778040818} + - component: {fileID: 7224489468790740980} + - component: {fileID: 4462642424141872188} + m_Layer: 0 + m_Name: ShapeBottomLeft + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7865774197778040818 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9032701300591666026} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -188.99962} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9049015333349338420} + m_RootOrder: 5 + 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: -35.099976, y: -32.099976} + m_SizeDelta: {x: 63, y: 63} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7224489468790740980 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9032701300591666026} + m_CullTransparentMesh: 1 +--- !u!114 &4462642424141872188 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9032701300591666026} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 33c4632329ed20f4d91996fd8e3e429f, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!1 &9049015333349338381 GameObject: m_ObjectHideFlags: 0 @@ -446,6 +758,7 @@ GameObject: - component: {fileID: 9049015333349338423} - component: {fileID: 9049015333349338378} - component: {fileID: 9049015333349338421} + - component: {fileID: 8866676399730726846} m_Layer: 0 m_Name: Player Prefab m_TagString: Untagged @@ -463,11 +776,16 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 3246767593435583328} - {fileID: 8230678735005219117} - {fileID: 4813213847545284154} - {fileID: 3300629709659245742} + - {fileID: 482762097022507376} + - {fileID: 7865774197778040818} + - {fileID: 4528333479651783988} + - {fileID: 8558891503575618383} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -505,6 +823,11 @@ MonoBehaviour: _forTopicSelect: 0 _playerNumber: 0 _spriteOptions: [] + PassInputOnto: {fileID: 0} + OntologyTopicData: + Topic: + Categories: [] + _rigidbody: {fileID: 0} --- !u!58 &9049015333349338422 CircleCollider2D: m_ObjectHideFlags: 0 @@ -562,3 +885,21 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 37dfc580ad57d894caaababe502afb5b, type: 3} m_Name: m_EditorClassIdentifier: + _useWorldSpace: 0 +--- !u!114 &8866676399730726846 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9049015333349338381} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ecbd2bb57a5bb334797ba646e21cceaa, type: 3} + m_Name: + m_EditorClassIdentifier: + _shapeSprites: + - {fileID: 482245573507682842} + - {fileID: 9032701300591666026} + - {fileID: 8283750470600269748} + - {fileID: 1933936841026696079} diff --git a/namedropper/Assets/Scripts/Category.cs b/namedropper/Assets/Scripts/Category.cs index 9e7bc00..fccf6c3 100644 --- a/namedropper/Assets/Scripts/Category.cs +++ b/namedropper/Assets/Scripts/Category.cs @@ -1,6 +1,8 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.SocialPlatforms.Impl; +using UnityEngine.TerrainUtils; using UnityEngine.UI; public class Category : MonoBehaviour @@ -12,7 +14,10 @@ public class Category : MonoBehaviour [SerializeField] SpriteRenderer _feedbackGood; [SerializeField] SpriteRenderer _feedbackBad; [SerializeField] GameObject _streak; + [SerializeField] TMPro.TMP_Text _shieldsText; + Player.Team _color = Player.Team.NEUTRAL; + int _shields = 0; private void Awake() { @@ -55,6 +60,40 @@ public class Category : MonoBehaviour return 0; } + public void AddScore(int score, Player.Team team) + { + if (score <= 0) + return; + + if (_color == team) + { + _shields += score; + } + else + { + _shields -= score; + if (_shields < 0) + { + _shields = (_shields * -1) -1; + _color = team; + } + } + + _shieldsText.text = _shields.ToString(); + if (_shields == 0) + _shieldsText.text = ""; + + Color newColor = Color.white; + if (_color == Player.Team.GREEN) + { + newColor = Color.green; + } + else + { + newColor = Color.red; + } + this.transform.Find("CategoryBox").gameObject.GetComponent().color = newColor; + } public void ShowFeedbackBad(string wrongAnswer) { ShowFeedback(_feedbackBad, duration: 2f); @@ -69,7 +108,7 @@ public class Category : MonoBehaviour void ShowFeedback(SpriteRenderer feedback, bool show = true, float duration = 1f) { - feedback.enabled = show; + //feedback.enabled = show; CancelInvoke(); Invoke("HideAllFeedback", duration); } diff --git a/namedropper/Assets/Scripts/Game.cs b/namedropper/Assets/Scripts/Game.cs index 00232da..30ff71f 100644 --- a/namedropper/Assets/Scripts/Game.cs +++ b/namedropper/Assets/Scripts/Game.cs @@ -107,7 +107,7 @@ public class Game : Level } - Topic.text = GameDataManager.Instance.CurrentTopic.Topic; + //Topic.text = GameDataManager.Instance.CurrentTopic.Topic; } diff --git a/namedropper/Assets/Scripts/Level.cs b/namedropper/Assets/Scripts/Level.cs index e8952aa..831f7d4 100644 --- a/namedropper/Assets/Scripts/Level.cs +++ b/namedropper/Assets/Scripts/Level.cs @@ -59,12 +59,15 @@ public class Level : MonoBehaviour if (Topic != null) Topic.gameObject.SetActive(false); yield return new WaitForSeconds(1f); - if (Topic != null) - Topic.gameObject.SetActive(true); - yield return new WaitForSeconds(2f); + //if (Topic != null) + //Topic.gameObject.SetActive(true); + //yield return new WaitForSeconds(2f); RoundNumber.text = ""; if (Topic != null) + { Topic.text = "GO!"; + Topic.gameObject.SetActive(true); + } ActivatePlayers(true); yield return new WaitForSeconds(1f); if (Topic != null) diff --git a/namedropper/Assets/Scripts/Player.cs b/namedropper/Assets/Scripts/Player.cs index 265f89e..3649878 100644 --- a/namedropper/Assets/Scripts/Player.cs +++ b/namedropper/Assets/Scripts/Player.cs @@ -53,7 +53,8 @@ public class Player : MonoBehaviour public enum Team { RED, - GREEN + GREEN, + NEUTRAL } public Rigidbody2D _rigidbody; @@ -219,10 +220,46 @@ public class Player : MonoBehaviour _dropping = false; _rigidbody.velocity = Vector3.zero; PickNewWord(); + GetComponent().Randomize(); } private void OnTriggerEnter2D(Collider2D collision) { + + CardData categoryCardData = collision.gameObject.GetComponent()._cardData; + + + if (categoryCardData != null) + { + int score = 0; + string message = ""; + CardData myCardData = GetComponent()._cardData; + if (categoryCardData._shape == myCardData._shape) { + score++; + message += "Shape\n"; + } + + if (categoryCardData._fill == myCardData._fill) + { + score++; + message += "Fill\n"; + } + + if (categoryCardData._number == myCardData._number) + { + score++; + message += "Count\n"; + } + + Category category = collision.gameObject.GetComponent(); + category.ShowFeedbackBad(message); + category.AddScore(score, _team); + + this.gameObject.SetActive(false); + Invoke("Respawn", 1f); + + } + /* //category Category category = collision.gameObject.GetComponent(); @@ -251,7 +288,7 @@ public class Player : MonoBehaviour Invoke("Respawn", 1f); } } - + */ //topic box TopicBox topicBox = collision.gameObject.GetComponent(); if (topicBox != null)