added scoring system for the bow game
This commit is contained in:
@@ -44,7 +44,7 @@ public class Menu : MonoBehaviour
|
||||
openMenuAction.action.performed += ToggleMenu;
|
||||
InputSystem.onDeviceChange += OnDeviceChange;
|
||||
canvas = GetComponent<Canvas>();
|
||||
canvas.enabled = false;
|
||||
setCanvasVisibility(false);
|
||||
|
||||
}
|
||||
public void DeactivateMenu() // Makes the ToggleMenu inable to toggle.
|
||||
@@ -57,20 +57,37 @@ public class Menu : MonoBehaviour
|
||||
activated = true;
|
||||
}
|
||||
|
||||
public void setCanvasVisibility(bool enabled)
|
||||
{
|
||||
canvas.enabled = enabled;
|
||||
}
|
||||
|
||||
private void ToggleMenu(InputAction.CallbackContext context)
|
||||
{
|
||||
if (!activated) return;
|
||||
|
||||
updateMenuTransform();
|
||||
|
||||
// Toggle the menu visibility
|
||||
setCanvasVisibility(!canvas.enabled);
|
||||
}
|
||||
|
||||
public Transform updateMenuTransform()
|
||||
{
|
||||
// Gets the transform of the menu Updates the transform along the way
|
||||
// Does not enable its visibility.
|
||||
|
||||
|
||||
// Get the camera's local Y rotation relative to the parent of MenuRotator
|
||||
float relativeYRotation = Camera.transform.localEulerAngles.y;
|
||||
|
||||
// Apply the relative Y rotation to MenuRotator while keeping X and Z unchanged
|
||||
MenuRotator.transform.localEulerAngles = new Vector3(0, relativeYRotation, 0);
|
||||
|
||||
// Set the menu position to match the camera's position in local space
|
||||
MenuRotator.transform.position = Camera.transform.position;
|
||||
MenuRotator.transform.position = Camera.transform.position;
|
||||
|
||||
return this.transform;
|
||||
|
||||
// Toggle the menu visibility
|
||||
canvas.enabled = !canvas.enabled;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
|
||||
@@ -549,9 +549,9 @@ MonoBehaviour:
|
||||
m_PlayHapticsOnSelectCanceled: 0
|
||||
m_HapticSelectCancelIntensity: 0
|
||||
m_HapticSelectCancelDuration: 0
|
||||
m_PlayHapticsOnHoverEntered: 0
|
||||
m_HapticHoverEnterIntensity: 0
|
||||
m_HapticHoverEnterDuration: 0
|
||||
m_PlayHapticsOnHoverEntered: 1
|
||||
m_HapticHoverEnterIntensity: 0.1
|
||||
m_HapticHoverEnterDuration: 0.5
|
||||
m_PlayHapticsOnHoverExited: 0
|
||||
m_HapticHoverExitIntensity: 0
|
||||
m_HapticHoverExitDuration: 0
|
||||
@@ -561,7 +561,7 @@ MonoBehaviour:
|
||||
m_AllowHoverHapticsWhileSelecting: 1
|
||||
m_LineType: 0
|
||||
m_BlendVisualLinePoints: 1
|
||||
m_MaxRaycastDistance: 10
|
||||
m_MaxRaycastDistance: 1000
|
||||
m_RayOriginTransform: {fileID: 0}
|
||||
m_ReferenceFrame: {fileID: 0}
|
||||
m_Velocity: 16
|
||||
@@ -587,7 +587,7 @@ MonoBehaviour:
|
||||
m_TimeToAutoDeselect: 3
|
||||
m_EnableUIInteraction: 1
|
||||
m_AllowAnchorControl: 0
|
||||
m_UseForceGrab: 1
|
||||
m_UseForceGrab: 0
|
||||
m_RotateSpeed: 180
|
||||
m_TranslateSpeed: 1
|
||||
m_AnchorRotateReferenceFrame: {fileID: 0}
|
||||
@@ -719,7 +719,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_LineWidth: 0.01
|
||||
m_OverrideInteractorLineLength: 1
|
||||
m_LineLength: 10
|
||||
m_LineLength: 5
|
||||
m_WidthCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
@@ -1248,9 +1248,9 @@ MonoBehaviour:
|
||||
m_PlayHapticsOnSelectCanceled: 0
|
||||
m_HapticSelectCancelIntensity: 0
|
||||
m_HapticSelectCancelDuration: 0
|
||||
m_PlayHapticsOnHoverEntered: 0
|
||||
m_HapticHoverEnterIntensity: 0
|
||||
m_HapticHoverEnterDuration: 0
|
||||
m_PlayHapticsOnHoverEntered: 1
|
||||
m_HapticHoverEnterIntensity: 0.1
|
||||
m_HapticHoverEnterDuration: 0.5
|
||||
m_PlayHapticsOnHoverExited: 0
|
||||
m_HapticHoverExitIntensity: 0
|
||||
m_HapticHoverExitDuration: 0
|
||||
@@ -1260,7 +1260,7 @@ MonoBehaviour:
|
||||
m_AllowHoverHapticsWhileSelecting: 1
|
||||
m_LineType: 0
|
||||
m_BlendVisualLinePoints: 1
|
||||
m_MaxRaycastDistance: 10
|
||||
m_MaxRaycastDistance: 1000
|
||||
m_RayOriginTransform: {fileID: 0}
|
||||
m_ReferenceFrame: {fileID: 0}
|
||||
m_Velocity: 16
|
||||
@@ -1286,7 +1286,7 @@ MonoBehaviour:
|
||||
m_TimeToAutoDeselect: 3
|
||||
m_EnableUIInteraction: 1
|
||||
m_AllowAnchorControl: 0
|
||||
m_UseForceGrab: 1
|
||||
m_UseForceGrab: 0
|
||||
m_RotateSpeed: 180
|
||||
m_TranslateSpeed: 1
|
||||
m_AnchorRotateReferenceFrame: {fileID: 0}
|
||||
@@ -1418,7 +1418,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_LineWidth: 0.01
|
||||
m_OverrideInteractorLineLength: 1
|
||||
m_LineLength: 10
|
||||
m_LineLength: 5
|
||||
m_WidthCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
|
||||
Reference in New Issue
Block a user