Josh 2 years ago
parent
commit
c45f9b1877
  1. 172
      namedropper/Assets/Prefabs/Category Prefab.prefab
  2. 6
      namedropper/Assets/Scenes/Game.unity
  3. 11
      namedropper/Assets/Scripts/Category.cs
  4. 12
      namedropper/Assets/Scripts/Player.cs

172
namedropper/Assets/Prefabs/Category Prefab.prefab

@ -34,6 +34,7 @@ Transform:
- {fileID: 1499098757669286101}
- {fileID: 124791215424900615}
- {fileID: 8816928777131923770}
- {fileID: 770537853553476569}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -63,6 +64,7 @@ MonoBehaviour:
- Lucia
_feedbackGood: {fileID: 4304540116731250660}
_feedbackBad: {fileID: 3551932467328341787}
_streak: {fileID: 1565607471538169626}
--- !u!61 &1085594869219034861
BoxCollider2D:
m_ObjectHideFlags: 0
@ -332,6 +334,176 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1565607471538169626
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 770537853553476569}
- component: {fileID: 5950246395176158827}
- component: {fileID: 1166984134160297719}
m_Layer: 0
m_Name: Streak
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &770537853553476569
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1565607471538169626}
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_Children: []
m_Father: {fileID: 1499098757095760799}
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: -122.7, y: -160.7}
m_SizeDelta: {x: 500, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!23 &5950246395176158827
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1565607471538169626}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
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 &1166984134160297719
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1565607471538169626}
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: 10 x 3
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: 4280805751
m_fontColor: {r: 0.46507028, g: 0.9150943, b: 0.15107687, 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
m_hasFontAssetChanged: 0
m_renderer: {fileID: 5950246395176158827}
m_maskType: 0
_SortingLayer: 0
_SortingLayerID: 0
_SortingOrder: 0
--- !u!1 &7182421569596414056
GameObject:
m_ObjectHideFlags: 0

6
namedropper/Assets/Scenes/Game.unity

@ -1140,7 +1140,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 1499098757095760799, guid: f3f23d9506e39c54cbd07779c62329a3, type: 3}
propertyPath: m_RootOrder
value: 5
value: 4
objectReference: {fileID: 0}
- target: {fileID: 1499098757095760799, guid: f3f23d9506e39c54cbd07779c62329a3, type: 3}
propertyPath: m_LocalPosition.x
@ -1393,6 +1393,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 554321083}
m_Modifications:
- target: {fileID: 770537853553476569, guid: f3f23d9506e39c54cbd07779c62329a3, type: 3}
propertyPath: m_LocalPosition.z
value: 188.9996
objectReference: {fileID: 0}
- target: {fileID: 1499098757095760768, guid: f3f23d9506e39c54cbd07779c62329a3, type: 3}
propertyPath: Name
value: The Mandalorian

11
namedropper/Assets/Scripts/Category.cs

@ -10,6 +10,7 @@ public class Category : MonoBehaviour
List<string> WorkingElements = new List<string>();
[SerializeField] SpriteRenderer _feedbackGood;
[SerializeField] SpriteRenderer _feedbackBad;
[SerializeField] GameObject _streak;
private void Awake()
{
@ -21,9 +22,16 @@ public class Category : MonoBehaviour
HideAllFeedback();
}
public void ShowFeedbackGood()
public void ShowFeedbackGood(int streak)
{
ShowFeedback(_feedbackGood);
_streak.SetActive(true);
_streak.GetComponent<TMPro.TMP_Text>().text = "10";
if (streak > 1)
{
_streak.GetComponent<TMPro.TMP_Text>().text += " x " + streak;
}
}
public void ShowFeedbackBad()
@ -42,6 +50,7 @@ public class Category : MonoBehaviour
{
ShowFeedback(_feedbackGood, false);
ShowFeedback(_feedbackBad, false);
_streak.SetActive(false);
}
public void ResetElements()

12
namedropper/Assets/Scripts/Player.cs

@ -19,6 +19,7 @@ public class Player : MonoBehaviour
[SerializeField] int _playerNumber;
bool _dropping = false;
Vector3 _originalPosition;
int _streak = 0;
public enum Team
{
RED,
@ -132,15 +133,20 @@ public class Player : MonoBehaviour
if (category.Elements.Contains(_text.text))
{
_game.AddScore(1, _playerNumber);
category.ShowFeedbackGood();
_streak++;
int score = 10 * _streak;
_game.AddScore(score, _playerNumber);
category.ShowFeedbackGood(_streak);
Respawn();
}
else
{
_streak = 0;
category.ShowFeedbackBad();
this.gameObject.SetActive(false);
Invoke("Respawn", 2f);
Respawn();
//Invoke("Respawn", 2f);
}
}

Loading…
Cancel
Save