Skip to content

Commit

Permalink
feat(UI): Add time scale slider
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Sep 4, 2023
1 parent 968b3ee commit a17e618
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Assets/JCSUnity/Scripts/UI/Slider/JCS_SoundSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class JCS_SoundSlider : MonoBehaviour
[SerializeField]
private JCS_SoundSettingType mSoundType = JCS_SoundSettingType.NONE;

/* Setter/Getter */
/* Setter & Getter */

public Slider slider { get { return this.mSlider; } }
public JCS_SoundSettingType SoundType { get { return this.mSoundType; } }
Expand Down
38 changes: 38 additions & 0 deletions Assets/JCSUnity/Scripts/UI/Slider/JCS_TimeScaleSlider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* $File: JCS_TimeScaleSlider.cs $
* $Date: 2023-09-03 14:19:04 $
* $Revision: $
* $Creator: Jen-Chieh Shen $
* $Notice: See LICENSE.txt for modification and distribution information
* Copyright (c) 2023 by Shen, Jen-Chieh $
*/
using UnityEngine;
using UnityEngine.UI;

namespace JCSUnity
{
/// <summary>
/// Slider component to control time scale value.
/// </summary>
[RequireComponent(typeof(Slider))]
public class JCS_TimeScaleSlider : MonoBehaviour
{
/* Variables */

private Slider mSlider = null;

/* Setter & Getter */

/* Functions */

private void Awake()
{
this.mSlider = this.GetComponent<Slider>();
}

private void Update()
{
Time.timeScale = mSlider.value;
}
}
}
11 changes: 11 additions & 0 deletions Assets/JCSUnity/Scripts/UI/Slider/JCS_TimeScaleSlider.cs.meta

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

3 changes: 3 additions & 0 deletions docs/ScriptReference/UI/Slider/JCS_TimeScaleSlider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# JCS_TimeScaleSlider

Slider component to control time scale value.

0 comments on commit a17e618

Please sign in to comment.