2019-04-07 10:03:16 -04:00
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.Serialization;
|
2019-04-07 05:10:09 -04:00
|
|
|
|
|
|
|
namespace UnityAtoms
|
|
|
|
{
|
|
|
|
[CreateAssetMenu(menuName = "Unity Atoms/Molecules/Timer/Timer")]
|
|
|
|
public class Timer : ScriptableObject
|
|
|
|
{
|
2019-04-07 10:03:16 -04:00
|
|
|
public bool Started { get { return _started; } }
|
|
|
|
|
|
|
|
public float TimeElapsed;
|
|
|
|
|
|
|
|
[FormerlySerializedAs("Started")]
|
|
|
|
[SerializeField]
|
|
|
|
private bool _started;
|
2019-04-07 05:10:09 -04:00
|
|
|
|
|
|
|
public void Start()
|
|
|
|
{
|
2019-04-07 10:03:16 -04:00
|
|
|
_started = true;
|
2019-04-07 05:10:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Stop()
|
|
|
|
{
|
|
|
|
TimeElapsed = 0f;
|
2019-04-07 10:03:16 -04:00
|
|
|
_started = false;
|
2019-04-07 05:10:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public float GetElapsedTime()
|
|
|
|
{
|
|
|
|
return TimeElapsed;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsStarted()
|
|
|
|
{
|
2019-04-07 10:03:16 -04:00
|
|
|
return _started;
|
2019-04-07 05:10:09 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|