Skip to content

feat: hide keyboard buttons after clicked #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 69 additions & 1 deletion src/maple-fighters/Assets/Maple Fighters/Scenes/Maps/Lobby.unity
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 581949298}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 4.7450647, y: 2.9696884, z: -10}
m_LocalPosition: {x: 4.105055, y: 2.971972, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 572659480}
Expand Down Expand Up @@ -1421,6 +1421,7 @@ GameObject:
- component: {fileID: 1079883172}
- component: {fileID: 1079883171}
- component: {fileID: 1079883173}
- component: {fileID: 1079883174}
m_Layer: 0
m_Name: Right
m_TagString: Untagged
Expand Down Expand Up @@ -1509,6 +1510,22 @@ Animation:
m_PlayAutomatically: 1
m_AnimatePhysics: 0
m_CullingType: 0
--- !u!114 &1079883174
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1079883170}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4c3d10b0b45754607bb54508ec0d3446, type: 3}
m_Name:
m_EditorClassIdentifier:
requiredPlayerState: 1
primaryKeyCode: 100
secondaryKeyCode: 275
colorSpeed: 0.5
--- !u!1 &1082050692
GameObject:
m_ObjectHideFlags: 0
Expand All @@ -1520,6 +1537,7 @@ GameObject:
- component: {fileID: 1082050694}
- component: {fileID: 1082050693}
- component: {fileID: 1082050695}
- component: {fileID: 1082050696}
m_Layer: 0
m_Name: Left
m_TagString: Untagged
Expand Down Expand Up @@ -1608,6 +1626,22 @@ Animation:
m_PlayAutomatically: 1
m_AnimatePhysics: 0
m_CullingType: 0
--- !u!114 &1082050696
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1082050692}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4c3d10b0b45754607bb54508ec0d3446, type: 3}
m_Name:
m_EditorClassIdentifier:
requiredPlayerState: 1
primaryKeyCode: 97
secondaryKeyCode: 276
colorSpeed: 0.5
--- !u!1 &1094532425
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2173,6 +2207,7 @@ GameObject:
- component: {fileID: 2031678497}
- component: {fileID: 2031678496}
- component: {fileID: 2031678498}
- component: {fileID: 2031678499}
m_Layer: 0
m_Name: Space
m_TagString: Untagged
Expand Down Expand Up @@ -2261,6 +2296,22 @@ Animation:
m_PlayAutomatically: 1
m_AnimatePhysics: 0
m_CullingType: 0
--- !u!114 &2031678499
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2031678495}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4c3d10b0b45754607bb54508ec0d3446, type: 3}
m_Name:
m_EditorClassIdentifier:
requiredPlayerState: 2
primaryKeyCode: 32
secondaryKeyCode: 0
colorSpeed: 0.5
--- !u!1 &2096287288
GameObject:
m_ObjectHideFlags: 0
Expand All @@ -2272,6 +2323,7 @@ GameObject:
- component: {fileID: 2096287291}
- component: {fileID: 2096287290}
- component: {fileID: 2096287289}
- component: {fileID: 2096287292}
m_Layer: 0
m_Name: Up
m_TagString: Untagged
Expand Down Expand Up @@ -2360,6 +2412,22 @@ Transform:
m_Father: {fileID: 323162669}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 270}
--- !u!114 &2096287292
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2096287288}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4c3d10b0b45754607bb54508ec0d3446, type: 3}
m_Name:
m_EditorClassIdentifier:
requiredPlayerState: 0
primaryKeyCode: 119
secondaryKeyCode: 273
colorSpeed: 0.5
--- !u!1 &2118034756
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ GameObject:
- component: {fileID: 193192975}
- component: {fileID: 193192974}
- component: {fileID: 193192973}
- component: {fileID: 193192976}
m_Layer: 0
m_Name: Down
m_TagString: Untagged
Expand Down Expand Up @@ -446,6 +447,22 @@ Transform:
m_Father: {fileID: 1117228358}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
--- !u!114 &193192976
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 193192972}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4c3d10b0b45754607bb54508ec0d3446, type: 3}
m_Name:
m_EditorClassIdentifier:
requiredPlayerState: 5
primaryKeyCode: 115
secondaryKeyCode: 274
colorSpeed: 0.5
--- !u!1 &298437731
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -508,6 +525,7 @@ GameObject:
- component: {fileID: 317925599}
- component: {fileID: 317925598}
- component: {fileID: 317925597}
- component: {fileID: 317925600}
m_Layer: 0
m_Name: Q
m_TagString: Untagged
Expand Down Expand Up @@ -596,6 +614,22 @@ Transform:
m_Father: {fileID: 1117228358}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &317925600
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 317925596}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4c3d10b0b45754607bb54508ec0d3446, type: 3}
m_Name:
m_EditorClassIdentifier:
requiredPlayerState: 8
primaryKeyCode: 113
secondaryKeyCode: 113
colorSpeed: 0.5
--- !u!1 &354198740
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -984,7 +1018,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 581949298}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.021780968, y: -11.365763, z: -10}
m_LocalPosition: {x: -0.021778107, y: -11.367054, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 572659480}
Expand Down Expand Up @@ -1949,7 +1983,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1151788562}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -12.8, y: -12.95, z: -10}
m_LocalPosition: {x: -12.799999, y: -12.95, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 713957756}
Expand Down Expand Up @@ -2804,6 +2838,7 @@ GameObject:
- component: {fileID: 1881879949}
- component: {fileID: 1881879948}
- component: {fileID: 1881879947}
- component: {fileID: 1881879950}
m_Layer: 0
m_Name: Ctrl
m_TagString: Untagged
Expand Down Expand Up @@ -2892,6 +2927,22 @@ Transform:
m_Father: {fileID: 1117228358}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1881879950
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1881879946}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4c3d10b0b45754607bb54508ec0d3446, type: 3}
m_Name:
m_EditorClassIdentifier:
requiredPlayerState: 7
primaryKeyCode: 306
secondaryKeyCode: 306
colorSpeed: 0.5
--- !u!1 &1904566971
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2933,6 +2984,7 @@ GameObject:
- component: {fileID: 2003073457}
- component: {fileID: 2003073456}
- component: {fileID: 2003073455}
- component: {fileID: 2003073458}
m_Layer: 0
m_Name: Up
m_TagString: Untagged
Expand Down Expand Up @@ -3021,6 +3073,22 @@ Transform:
m_Father: {fileID: 1117228358}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 270}
--- !u!114 &2003073458
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2003073454}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4c3d10b0b45754607bb54508ec0d3446, type: 3}
m_Name:
m_EditorClassIdentifier:
requiredPlayerState: 5
primaryKeyCode: 119
secondaryKeyCode: 273
colorSpeed: 0.5
--- !u!1 &2094996518
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using UnityEngine;

namespace Scripts.Gameplay.Map.Objects
{
public class ClickableKeyboardGuidance : MonoBehaviour
{
[SerializeField]
private KeyCode primaryKeyCode;

[SerializeField]
private KeyCode secondaryKeyCode;

[SerializeField]
private float colorSpeed;

private bool clicked;

private new Animation animation;
private SpriteRenderer spriteRenderer;

private void Awake()
{
animation = GetComponent<Animation>();
spriteRenderer = GetComponent<SpriteRenderer>();
}

private void Update()
{
if (clicked)
{
DeacraseColor();
}
else
{
clicked = Input.GetKeyDown(primaryKeyCode) || Input.GetKeyDown(secondaryKeyCode);
}
}

private void DeacraseColor()
{
animation.Stop();

if (spriteRenderer.color.a <= 0)
{
Destroy(gameObject);
}

var color = new Color(0, 0, 0, 1);
spriteRenderer.color -= color * colorSpeed * Time.deltaTime;
}
}
}

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

Loading